freecwmp
[Top] [All Lists]

Fwd: Re: Question concerning libubox and multithread

To: freecwmp@linux-mips.org
Subject: Fwd: Re: Question concerning libubox and multithread
From: KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Date: Tue, 20 Nov 2012 15:26:43 +0100
In-reply-to: <509A6EBE.2040205@openwrt.org>
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <509A6EBE.2040205@openwrt.org>
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2


-------- Message original --------
Sujet:  Re: Question concerning libubox and multithread
Date :  Wed, 07 Nov 2012 15:22:54 +0100
De :    Felix Fietkau <nbd@openwrt.org>
Pour :  KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Copie à :  <blogic@openwrt.org>, <steven@midlink.org>



On 2012-11-07 2:59 PM, KALLEL Mohamed wrote:
Hello

I m contributing in the development of an opensource project which use
libubox. and I remarked that libubox execute handler functions in
monothread mode and not in muItithread mode.

1) so I m wondering if the libubox supports execution of handler in
multi thread mode ?
2) if yes how to activate multithread for registred handlers with libubox
3) if no. I m able to create 2 threads in my main program and then each
thread will call libubox functions to register handler function. Could
you give a quick how to do it with libubox?
Hi,

uloop in libubox is currently not designed in a thread-safe way. I would
recommend running uloop in one thread only, and handing processing for
received events off to other threads. Would that be enough for the needs
of your application or do you need any specific changes?

I have not really looked at thread-safe use of epoll yet (which is used
in uloop internally), I only remember some recent kernel related
discussion pointing out that its threaded use may be a bit tricky
because of some race conditions that were only fixed recently.

- Felix





<Prev in Thread] Current Thread [Next in Thread>
  • Fwd: Re: Question concerning libubox and multithread, KALLEL Mohamed <=