Re: use threading without classes



Is there any reason why you wouldn't want to do this using the the
threading class? To each his own I suppose. You can try the following
though you'll at least need to use functions:


import time
import thread

def myfunction(string,sleeptime,*args):
while 1:

print string
time.sleep(sleeptime) #sleep for a specified amount of time.

if __name__=="__main__":

thread.start_new_thread(myfunction,("Thread No:1",2))

while 1:pass

.



Relevant Pages

  • Re: whats wrong with "lambda x : print x/60,x%60"
    ... >> I dashed that last part off quickly, so I don't have a good reason. ... > If one needs it for debugging, it raise an alarm bell if lambda is the ... > def debug: print x ... Prev by Date: ...
    (comp.lang.python)
  • Re: Method Definitions
    ... Daniel Schierbeck writes: ... > Can anyone give me a good reason *not* to have `def' return a symbol? ... Prev by Date: ...
    (comp.lang.ruby)
  • Re: pre-PEP: Simple Thunks
    ... change Your thunk somehow e.g. from ... def yield_thunk: ... This is the reason why those ...
    (comp.lang.python)
  • bsddb3 thread problem
    ... If i use simple python threaded function instead of threading class, ... I suppose bsddb3 DB can be accessed from mutiple threads? ... def run: ... queueDB = db.DB ...
    (comp.lang.python)
  • Re: sorteddict PEP proposal [started off as orderedict]
    ... I disagree with your reason for introducing a sorteddict - the main ... the last sort, but I haven't the time to do a thorough job. ... def copy: ...
    (comp.lang.python)