[LV2] worker thread question

David Robillard d at drobilla.net
Sun Dec 30 08:01:49 PST 2012

On Sun, 2012-12-30 at 07:52 +0100, Robin Gareus wrote:
> On 12/30/2012 07:02 AM, hermann meyer wrote:
> >> Accessing 'self->schedule' from this context is just wrong.
> > Could you explain me why? I call a thread from a other thread, so under
> > which circumstances it mater from which thread I call it? If I get what
> > you mean here, I could truly move this call to run, just using a
> > sem_post.
> sem_post() is the same in green. possibly makes things even worse. --
> but I'll leave that to Dave, he loves bashing sem_post() :)

Hmmm? I am a known superfan of sem_post() :)

It is the fastest sync primitive by a long shot and the only one that's
safe (enough) to use in RT threads.  The counting semantics are very
useful alongside queues as well.  If you need to wake up a thread from
run(), it is the best choice, though of course you don't want to hammer
on the thing every cycle and no sync at all is best if possible.

I really wish threading abstractions would stop omitting this graceful
primitive because clunky mutexes and conds are supposedly
"equivalent" :/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20121230/20966008/attachment-0002.pgp>

More information about the Devel mailing list