How to talk to a specific thread in a server

Björn Döbel doebel at
Thu May 8 21:03:05 CEST 2014

Could you share your client and server's code?


Am 08.05.2014 21:02, schrieb Yuxin Ren:
> Year,
> I did those thing. Each server tread has its own server obj and register
> server instance, and it calls register_obj() and server.loop() on their own.
> But this does not work. And actually the master thread in server always
> receives all requests. When I let the master thread to spin, the server
> cannot
> receive any request, even though other threads in server block on the
> server.loop() function.
> I am really confused about it.
> Thank you.
> On Thu, May 8, 2014 at 12:22 PM, Björn Döbel <doebel at>wrote:
> Am Do 08 Mai 2014 18:17:54 CEST schrieb Yuxin Ren:
>>>> HiThank you very much for your reply.I did what you said, but the
> behavior is very confusing.I create two channels in lua script, and
> correspond each channel to a pair of client and server threads.
>>>> In the server side, each thread registers its own server obj to its
> own Registry_server, and of course they have different dispatch
> functions.Now the result is only one server thread receive all requests
> from client, and it selects different dispatch function to run based on the
> request.
>>>> But I want different threads to run different dispatch function, not
> only one server thread process all requests using different dispatch
> functions.Do you have any ideas about this?Thank you.
>>>> On Thu, May 8, 2014 at 2:07 AM, Björn Döbel <doebel at>
> wrote:
>>>> ********* *ANFANG des verschlüsselten oder unterschriebenen Bereichs*
> *********
>>>> Hi,
>>>> On 08.05.2014 03:29, Yuxin Ren wrote:
>>>>> I have one client and one server talking to each other, and both of
>>>>> them have 2 threads. I want thread 1 in client only talk to thread
>>>>> 1 in server, and thread 2 in client only talk to thread 2 in
>>>>> server. How can I achieve this?
>>>> The simple client/server example
>>>> ( shows how to
>>>> connect a single thread in each process (or task in L4 speak). You
>>>> could extend this example to create two channels in the Lua setup
>>>> file, pass both channels to the tasks during startup and then let each
>>>> thread use one of them for communication with its counterpart.
>>>> Note that does not completely enforce your requirement that each
>>>> thread can only talk to exactly one other. Capabilities (e.g., for the
>>>> communication channels) are shared per task and technically each
>>>> thread could therefore send messages on each channel. If you want
>>>> strict isolation, you have to separate the threads into separate tasks.
>>>> Bjoern
>>>> ********* *ENDE des verschlüsselten oder unterschriebenen Bereichs*
> *********
>>>> _______________________________________________
>>>> l4-hackers mailing list
>>>> l4-hackers at
> Quick guess: your separate threads need to call the register_obj()
> function and the server.loop() functions on their own. (You also need
> two independent instances of the Server_object.)
> Bjoern

More information about the l4-hackers mailing list