Rob Mayoff wrote:
>
> +---------- On Sep 21, Constantin Teodorescu said:
> > So, ns_event set what will wake who? My thread?
> > What would be the result?
>
> Of the threads blocking in "ns_event wait" and "ns_event timedwait", one
> at random will be unblocked.

So, if I understood corectly:

with ns_event set       -> just one thread will be wake up
with ns_event broadcast -> all the threads waiting will be waked up

> > I am experiencing some deadlocks with ns_event wait (with timeout) that
> > refuses to wake up himself after timeout!
>
> If you provide a test case, we might be better able to help.

It's difficult to reproduce it because it's an application with a big
database and a memory cache. Operations are also on database and on
memory vectors, I had to block transactions on some products, and to
wake up waiting threads when transactions ends.

The "client" is launching very fast 10 tasks that try do to the same
thing (just to test the blocking mechanism). Randomly, 7 of them are
finishing (maybe 5, maybe 6) the other are inifinitely waiting, even I
have specified a ns_event wait with timeout.

I will try to shrink the application just to a couple of procedures in
order to reproduce the behaviour!

teo

Reply via email to