
Hey Group: I find myself using Threads quite a bit, and I so often write: bContinue= True And in the thread: while bContinue: And elsewhere: if ...: bContinue= False Proposing for the standard library: th= threading.Thread( target= myfunction ) def myfunction( selfth ): while selfth.bContinue: ... and th.bContinue= False. 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 (currently neglects to account for remaining unelapsed seconds), or 'secs' seconds elapses. Set 'stopped' and 'unpaused' with Stop(), Pause(), and Resume(). Also, Going() returns not stopped.isSet().''' self.stopped.wait( secs ) self.unpaused.wait() #secs- timeout or sth. Additional; further proposing: def Copy( self, runimm= None, name= None ), def StopAll(), def JoinAll(), def PauseAll(), def ResumeAll(). 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 post. Thank you and sincerely, Aaron
participants (1)
-
Aaron Brady