[ZODB-Dev] Quick ZODB connection synch question
Shane Hathaway
shane at zope.com
Mon Sep 29 13:55:33 EDT 2003
Nicholas Henke wrote:
> On Mon, 2003-09-29 at 11:00, Shane Hathaway wrote:
>
>>Is this the answer you're looking for, Nicholas?
>>
>> import asyncore
>> asyncore.loop()
>>
>>If you need to run that in a separate thread:
>>
>> import thread, asyncore
>> thread.start_new_thread(asyncore.loop, ())
>
>
> Oh. Guess it is that simple. :) How about shutting it down cleanly?
That part might be more difficult. If asyncore is running in an
independent thread, it's not easy to tell it to stop. One way to deal
with that is to write your own loop, where the body of the loop calls
asyncore.poll() with a short timeout and checks a global variable to see
if it's time to stop.
Shane
More information about the ZODB-Dev
mailing list