Subj : Re: lockless low-overhead 'pipes' (w/semaphores) To : comp.programming.threads From : David Schwartz Date : Tue Apr 19 2005 01:50 pm wrote in message news:1113939993.330667.40440@z14g2000cwz.googlegroups.com... > Looking briefly, it appears that there may be a possible deadlock or > race condition, but after exhaustively going through the algorithm's > paths on paper, I was unable to come up with anything conclusive. Are > my assumptions correct in assuming that it is free of deadlocks and > race conditions? Granted, we could spin once in the while loop (which > would happen very rarely and is not critical). I depends upon your assumed memory model. If, for example, you're just assuming a POSIX-compliant environment, there's no guarantee the consumer will read the data the producer wrote (instead of stale data stuck in some cache somewhere), since the consumer doesn't hold the same lock the producer held. DS .