+---------- On Feb 22, Andrew Piskorski said:
> Oh.  I think I just realized (at least one reason) why.  The flag
> value, is so if T2 does its ns_cond broadcast BEFORE T1 starts doing
> ns_cond wait, that T1 will know that the event already occurred,
> right?  Is that the only reason?

Yes.

It doesn't really have to be a flag. It can be any data. For example,
each connection thread checks the connection queue; if the queue is
empty, then it waits on a condition which will be broadcast by the
connection-accepting thread.  Obviously, a connection could come in
while all the connection threads are busy; in that case, no one will
"hear" the signal, but the connection-accepting thread will broadcast
anyway.

Reply via email to