[issue4293] Thread Safe Py_AddPendingCall

Mark Dickinson report at bugs.python.org
Fri Jan 16 23:31:53 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

How about using a timer instead of the 'count += 1' loop:  after starting 
the 32 self.pendingcalls_submit threads, set up a threading.Event and 
start yet another thread that simply does a time.sleep(5.0) (or whatever) 
and then sets that event.

Then your waiting loop could be something like:

while not self.my_event.is_set():
    for i in range(1000):
        a = i*i
self.assertEqual(len(l), n)

There's probably a better way, but that's the best I can come up with this 
late on a Friday night...

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4293>
_______________________________________


More information about the Python-bugs-list mailing list