Re: killing thread after timeout

2005-09-08 Thread Bryan Olson
Paul Rubin wrote: > To get even more OS-specific, AF_UNIX sockets (at least on Linux) have > a feature called ancillary messages that allow passing file > descriptors between processes. It's currently not supported by the > Python socket lib, but one of these days... . But I don't think > Windows

Re: killing thread after timeout

2005-09-08 Thread Jacek Popławski
Paul Rubin wrote: > Maybe the child process can just use sigalarm instead of a separate > thread, to implement the timeout. Already tried that, signals works only in main thread. > To get even more OS-specific, AF_UNIX sockets (at least on Linux) have > a feature called ancillary messages that al

Re: killing thread after timeout

2005-09-08 Thread Paul Rubin
Bryan Olson <[EMAIL PROTECTED]> writes: > First, a portable worker-process timeout: In the child process, > create a worker daemon thread, and let the main thread wait > until either the worker signals that it is done, or the timeout > duration expires. As the Python Library Reference states in > s

Re: killing thread after timeout

2005-09-08 Thread Jacek Popławski
Bryan Olson wrote: > First, a portable worker-process timeout: In the child process, > create a worker daemon thread, and let the main thread wait > until either the worker signals that it is done, or the timeout > duration expires. It works on QNX, thanks a lot, your reply was very helpful! > I

Re: killing thread after timeout

2005-09-06 Thread Bryan Olson
Bryan Olson wrote: [Some stuff he thinks is right, but might not answer the real question] Definitely look into Peter Hanson's answer. Olson's answer was about timing-out one's own Python code. Bryan Olson has heretofore avoided referring to himself in the third person, and will hence forth end

Re: killing thread after timeout

2005-09-06 Thread Bryan Olson
Jacek Poplawski had written: >> I am going to write python script which will read python >> command from socket, run it and return some values back to >> socket. >> >> My problem is, that I need some timeout. Jacek Poplawski wrote: > After reading more archive I think that solution may be t

Re: killing thread after timeout

2005-09-06 Thread Peter Hansen
Jacek Popławski wrote: > I am going to write python script which will read python command from > socket, run it and return some values back to socket. (Sounds like a huge security risk, unless you have tight control over who can connect to that socket.) > My problem is, that I need some timeout

Re: killing thread after timeout

2005-09-06 Thread Steve Horsley
Jacek Popławski wrote: > Hello. > > I am going to write python script which will read python command from > socket, run it and return some values back to socket. > > My problem is, that I need some timeout. I need to say for example: > > os.system("someapplication.exe") > > and kill it, if it

Re: killing thread after timeout

2005-09-06 Thread [EMAIL PROTECTED]
You'll need a watchdog thread that handles the other threads. The watchdog thread just builds a table of when threads were started, and after a certain # of seconds, expires those threads and kills them. -- http://mail.python.org/mailman/listinfo/python-list

Re: killing thread after timeout

2005-09-06 Thread Jacek Popławski
After reading more archive I think that solution may be to raise an Exception after timeout, but how to do it portable? -- http://mail.python.org/mailman/listinfo/python-list

killing thread after timeout

2005-09-06 Thread Jacek Popławski
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for example: os.system("someapplication.exe") and kill it, if it waits longer than let's say 100 seconds I