2 Jun
2003
2 Jun
'03
2:41 a.m.
[Dieter Maurer]
In other (i.e. non-Zope) code, I saw code like:
lock.release() sleep(0) # indicate, threads should switch, if necessary lock.acquire()
Of course, "sleep(0)" may not force a thread switch on all platforms.
sleep(0) definitely forces a thread to yield its timeslice on Windows, definitely does not on Solaris, and "beats me" for everything else. Windows is happy to switch threads frequently without this kind of trickery, though.
My lock time optimization holds the lock only while it decides whether it has finished. It looks like: ...
Sorry, I don't know the packing code well enough to comment.