Thread confusion?

Benjamin Schollnick junkster at rochester.rr.com
Wed May 23 17:32:01 EDT 2001


I'm having a problem with python threading, where python is probably 
doing EXACTLY as it was designed, but it's not what I would expect.

Example:

      def   run_a_thread ( value1, value2):
         d1 = run_sub_function1 (value1)
         d2 =run_sub_function2 (value2)
      return d1, d2   

   data = start_new_thread (run_a_thread, (v1, v2,) )

Now the thread appears to start, but as far as I can tell, it runs for 
"no time", and returns value of NONE.

As I've read, the thread continues until the function that is run is 
exited.... But run_a_thread isn't exited until after run_sub_function2 
is finished (*In my Logical universe that is*)

I'm assuming as soon as run_a_thread runs the "run_sub_function1" 
module, run_a_thread is considered "finished", and the thread closes...

Am I correct?

Any suggestions on work arounds?

         = Benjamin



More information about the Python-list mailing list