[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multithreading, callbacks from unknown threads
- From: Javier Guerra Giraldez <javier@...>
- Date: Fri, 16 Mar 2012 16:45:21 -0500
On Fri, Mar 16, 2012 at 4:14 PM, Thijs Schreijer
<thijs@thijsschreijer.nl> wrote:
> Recently there was a thread regarding callbacks from Qt, I’m planning to
> create a binding also for a library that has its own threadpool, and hence
> face similar synchronization issues.
>
>
>
> I created a library (called DarkSideSync) to handle this in a generic way
> using a socket. Background threads can call its ‘deliver’ function where the
> data will be queued in a thread safe way. From the Lua side a ‘poll’ method
> is available to collect the data. The library can fire a UDP packet on a
> local port for every delivery queued by a background thread.
even on localhost, using UDP for messaging has a perceptible overhead.
feel free to steal code from my helper threads toolkit [1] where it
handles a thread pool in C with a single Lua space by using FIFO
queues.
[1]:http://helper-threads.luaforge.net/
--
Javier