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
unnecessary time), but if a thread use more than 10 sec. stop wait (I
kill it) .... when all threads have finished their work or when they
have used all their available time (10 sec.) the program must go on
(don't wait).

It's not possible to kill a thread. If you want a thread to have a
maximum time, the thread must check occasionally how long it has been
running and terminate if necessary.

Another programming language (Java) originally had the ability to kill
threads, but that was later deprecated because it caused problems due to
not knowing what the thread was doing when it was killed (it might have
been in the middle of updating something at the time, for example,
leaving the system in an inconsistent state).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to