Re: max time threads

2010-06-18 Thread MRAB
pacopyc wrote: On 19 Giu, 00:27, MRAB wrote: pacopyc wrote: [snip] Ok, the problem is that I want fix a time max for each thread. For example run 10 threads (each can terminate its work in 10 sec. max fixed time) and wait them. If they finish its work in < 10 sec. (for example 2 sec.) very go

Re: max time threads

2010-06-18 Thread pacopyc
On 19 Giu, 00:27, MRAB wrote: > pacopyc wrote: > > [snip] > > Ok, the problem is that I want fix a time max for each thread. For > > example run 10 threads (each can terminate its work in 10 sec. max > > fixed time) and wait them. If they finish its work in < 10 sec. (for > > example 2 sec.) very

Re: max time threads

2010-06-18 Thread MRAB
pacopyc wrote: [snip] Ok, the problem is that I want fix a time max for each thread. For example run 10 threads (each can terminate its work in 10 sec. max fixed time) and wait them. If they finish its work in < 10 sec. (for example 2 sec.) very good ... go on immediately (don't wait unnecessa

Re: max time threads

2010-06-18 Thread pacopyc
On 18 Giu, 01:04, MRAB wrote: > pacopyc wrote: > > Hi, I'm trying to work with threads and I need your help. This is > > code: > > > from threading import Thread > > from Queue import Queue > > import time > > import random > > > def test_fun (k,q,t): > >     time.sleep(t) > >     print "hello wor

Re: max time threads

2010-06-17 Thread MRAB
pacopyc wrote: Hi, I'm trying to work with threads and I need your help. This is code: from threading import Thread from Queue import Queue import time import random def test_fun (k,q,t): time.sleep(t) print "hello world from thread " + str(q.get()) + " (sleep time = " + str(t) + " sec.

max time threads

2010-06-17 Thread pacopyc
Hi, I'm trying to work with threads and I need your help. This is code: from threading import Thread from Queue import Queue import time import random def test_fun (k,q,t): time.sleep(t) print "hello world from thread " + str(q.get()) + " (sleep time = " + str(t) + " sec.)" q.task_don