icelava.net

INSERT neural.pulsation INTO public_brain FROM flesh_processor WHERE neural.retention < 0.1
Welcome to icelava.net Sign in | Help
in Search

Threading question

Last post 01-02-2005, 4:00 by icelava. 3 replies.
Sort Posts: Previous Next
  •  01-01-2005, 23:29 843

    Threading question

    If i create a new thread th1 in a while loop and the loop runs 5 times.Does the end result being 5 threads of th1 being created?

  •  01-01-2005, 23:54 844 in reply to 843

    Re: Threading question

    It depends on whethet your variable th1 is declared globally in the class or locally in the method. If it is local, you may have threads that get orphaned as the variable goes out of scope.

    I do not know if the Thread object can be cleanly destroyed without you putting in some manual effort of aborting the thread (supposing it is running), since it is an actual piece of execution rather than a container of data like normal objects.
  •  01-02-2005, 0:25 845 in reply to 844

    Re: Threading question

    The thread is declared globally,but created in the loop using the NEW keyword.
  •  01-02-2005, 4:00 846 in reply to 845

    Re: Threading question

    Then you only have one reference point, maintaining hold to one thread. The rest are lost references. If you need a pool of threads, I suggest you consolidate them with a Collection-type object.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems