From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2005-09-14 06:09:23
Alexander Terekhov wrote:
>For algorithm, see pthreads-win32.
Thank you for the pointer, I already knew it, but I have to admit,
that I did not study the algorithm beforehand, to be able to approach
the problem from a different angle. (Forgive me my germanish tounge).
I suppose you are refering to
Algorithm 8a / IMPL_SEM,UNBLOCK_STRATGEY == UNBLOCK_ALL
>Your locking is way too strict (with two waiters on CV, you're blocking
>the second signal across context switch).
Now that I tried to compare to your algorithm I do not understand
what you really mean by this. Could you please elaborate?
Do you refer to WaitForMultipleObjects waiting on two events?
What is "second signal" refering to? Two callers to pthread_cond_signal?
Besides your comment "is way too strict" do you think my code
is incorrect too?
Timeout handling and cancellation aside, I see my algorithm semantically
equivalent to yours. The main difference is that I am using Events to
waiters, while you are using a Semaphore.
Also I am using two Event objects and one Semaphore per condition,
while you are using 3 Semaphore objects per condition. So also the
resource cost is roughly same.
I will try to add timeout handling next, to see how much code
size will increase.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk