thread will also exit
when the function raises an unhandled exception; a stack trace will be
printed unless the exception is SystemExit.
