[Python-ideas] Thread object
castironpi at comcast.net
Fri Jan 11 08:43:48 CET 2008
I find myself using Threads quite a bit, and I so often write:
And in the thread:
if ...: bContinue= False
Proposing for the standard library:
th= threading.Thread( target= myfunction )
def myfunction( selfth ):
Of course, there is a little more functionality that's very common as well.
Throw it in, touched up from above:
def pausesleep( self, secs ):
'''Pauses until 'stopped' is set, 'unpaused' is set
neglects to account for remaining unelapsed seconds),
or 'secs' seconds elapses. Set 'stopped' and 'unpaused'
with Stop(), Pause(), and Resume(). Also, Going() returns
self.stopped.wait( secs )
self.unpaused.wait() #secs- timeout or sth.
Additional; further proposing:
def Copy( self, runimm= None, name= None ),
However quote the docs: 'group should be None; reserved for future extension
when a ThreadGroup class is implemented', so this may be under way.
Current implementation (read: working version) available and offered to
Thank you and sincerely,
More information about the Python-ideas