Locking error (?!?)
Scott Pigman
scottpig at some.where.com
Fri Mar 28 10:31:55 EST 2003
Hi,
is this a bug in my code or my brain:
------------------------------------- class Agent:
assert self.lock.locked()
self.OUT_SOCKET.send(message)
assert self.lock.locked()
response = self.OUT_SOCKET.recv(Agent.MESSAGE_BUFFER_SIZE) assert
self.lock.locked() ## FAILS
--------------------------------------
self.lock is an object of type threading.Lock, which was previously
acquired ( lock.acquire() ). The first two assertions pass, the third one
fails. can anybody give me some insight why? I had thought that once
aquired, the lock will remain lock until the locking thread releases it.
if not, then how do i get that behaviour?
thank's in advance,
Scott Pigman
More information about the Python-list
mailing list