Threads and Interpreter death

  • Thread starter Carl J. Van Arsdall
  • Start date
C

Carl J. Van Arsdall

I've been toying with threads a lot lately and I've noticed that if a
scripting error occurs in a thread the thread dies, but not the process
that spawned the thread.

Is python supposed to behave this way or is this type of behavior
accidental?

Thanks,

Carl


--

Carl J. Van Arsdall
(e-mail address removed)
Build and Release
MontaVista Software
 
R

Rene Pijlman

Carl J. Van Arsdall:
I've been toying with threads a lot lately and I've noticed that if a
scripting error occurs in a thread the thread dies, but not the process
that spawned the thread.

Is python supposed to behave this way or is this type of behavior
accidental?

"start_new_thread(function, args[, kwargs])
When the function terminates with an unhandled exception, a stack trace is
printed and then the thread exits (but other threads continue to run)."
http://docs.python.org/lib/module-thread.html
 
B

Bryan Olson

Rene said:
Carl J. Van Arsdall:
I've been toying with threads a lot lately and I've noticed that if a
scripting error occurs in a thread the thread dies, but not the process
that spawned the thread.

Is python supposed to behave this way or is this type of behavior
accidental?


"start_new_thread(function, args[, kwargs])
When the function terminates with an unhandled exception, a stack trace is
printed and then the thread exits (but other threads continue to run)."
http://docs.python.org/lib/module-thread.html

And you might also want to see threading.thread's setDaemon() method:

The entire Python program exits when no active non-daemon
threads are left.

http://docs.python.org/lib/thread-objects.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top