tevent in multithreaded programs
Volker.Lendecke at SerNet.DE
Fri Jan 30 13:16:37 MST 2015
On Fri, Jan 30, 2015 at 03:03:25PM -0500, Simo wrote:
> FWIW, I had a chat with Jeff on IRC and suggest him to use the same
> approach we use to handle signals.
> Namely create a sentinel pipe and add it as fd event, also create a main
> list that is accessed via mutexes (or other suitable locking or lockless
> When the non-main threads need to add fd events to the main loop, add
> the fd to the main list then write() 1 byte to the sentinel pipe.
> The write() will cause the main loop to run a fd handler that will take
> care of drying up both the pipe and the main list and create appropriate
> fd events in it.
Sounds like a plan. Do you really need the "main list"?
Can't you just write the fd number into the pipe? While it's
in transit, its ownership might be a bit undefined, but you
might get away without mutexes.
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical