[ECOS] Condition Variables w/o mutual exclusion?
Hugo Tyson
hmt@redhat.com
Wed Oct 3 07:34:00 GMT 2001
> > Beware though that a flag "setbits" has broadcast semantics
> > (which is what you want), so it will take time - perhaps a lot
> > of time - proportional to the number of threads that were
> > waiting. *That*'s the reason using this primitive in a DSR
> > might be recommended against.
>
> Setbits won't take any longer than a cond_broadcast for a given
> number of waiting threads, will it? In my applications there's
> only one, but I don't want to limit it in case others want to
> have multiple waiting threads.
Setbits takes a little longer than a cond_broadcast 'cos it has to do
boolean arithmetic to determine whether to awaken each thread - but that
overhead is constant per thread *examined* (rather than per-thread
awakened), there's no N^2 effect or anything horrid like that. It's linear
on Nthreads just like a cond_broadcast.
If you're only using one or a few threads, and only ever waiting on and
setting one bit I wouldn't worry about it.
- Huge
More information about the Ecos-discuss
mailing list