Antoon Pardon <[EMAIL PROTECTED]> writes: > The tube will have an open method, with as argument an > access parameter that will determine if the thread wants > to put things (write) on the queue or will get (read) things > from the queue (or both). Now what I want is that a thread that > opens the tube for read access will block until a thread opens > the same tube for write access. > > The problem is how do I put such a requirement in a test case?
Just open the tube for reading in a separate thread, with something like: global done, lock done = False t = tube.open(self, "r") done = True Then you can tell whether the open is blocked by checking the done flag. The test fixture would then open the tube for writing, checking the flag immediately before and after. Actually you will need some synchronization to make sure there's no race condition between "open" returning and the flag being set. I'm sure you can figure out how. -- http://mail.python.org/mailman/listinfo/python-list