Hi,
I want to have the loop() method of a Registry_server instance inside a pthread. When the client sends messages, I get the IPC error 35 (could not figure out what that error code means).
As soon as the loop() is invoked in my main thread, messages come through. Here is some pseudo code:
start_thread() { //pack args int err = pthread_create(&my_thread, NULL, &thread_fn, &args); printf("pthread_create says %d", err); }
thread_fn(args) { L4Re::Util::Registry_server<>* svr = args.server; server_obj* my_server = args.server_obj_instance;
svr->registry()->register_obj(my_server, "foo"); svr->loop(); }
class server_obj : public L4::Server_object { public: int dispatch( ... ); }
server_obj::dispatch(...) { //never called }
Thanks, Tobi
Hi,
On Mon Nov 24, 2014 at 11:06:36 +0100, Tobias Sturm wrote:
I want to have the loop() method of a Registry_server instance inside a pthread. When the client sends messages, I get the IPC error 35 (could not figure out what that error code means).
As soon as the loop() is invoked in my main thread, messages come through. Here is some pseudo code:
start_thread() { //pack args int err = pthread_create(&my_thread, NULL, &thread_fn, &args); printf("pthread_create says %d", err); }
thread_fn(args) { L4Re::Util::Registry_server<>* svr = args.server; server_obj* my_server = args.server_obj_instance;
svr->registry()->register_obj(my_server, "foo"); svr->loop(); }
class server_obj : public L4::Server_object { public: int dispatch( ... ); }
server_obj::dispatch(...) { //never called }
The server object (srv) constructor has a default argument telling it the thread to attach to. The default is l4re_env()->main_thread. In your case you have to give it L4::CapL4::Thread(pthread_getl4cap(my_thread)) (or pthread_self()), so that messages will be going to the pthread.
Adam
l4-hackers@os.inf.tu-dresden.de