Please help me with an idea!
I have a number of threads (client connections) that are trying to do
something on the server (database operations and so on) but some of them
should wait until some events is happening! (the event is the ending of
a database transaction wither with COMMIT or ROLLBACK).
The mutexes or readwrite locks cannot be used here.
I would need a mechanism like 'notify' , and something like ns_wait
notify waiting for an event notified by other threads.
I have studied the semaphore mechanism but I can't figure it how can be
used!
Just to be sure that I have been clear enough!
There is no mutex mechanism!
I can allow multiple database transactions in the same time, but when
one transactions ends, other threads that are waiting for the signal
should be awaken, test a nsv_variabile if they can enter into a BEGIN
TRANSACTION, some of them can, and they do enter, some of them don't and
they should sleep until the next transaction ends , when they should
wake up and test again the nsv_ variable, and so on ... forever :-)
Any clues?
Constantin Teodorescu
Braila, ROMANIA