Results 1 to 7 of 7
Thread: dynamic thread handling....
- 08-29-2008, 09:04 AM #1
Member
- Join Date
- Jun 2008
- Posts
- 39
- Rep Power
- 0
dynamic thread handling....
hello friends,
i want to do a dynamic thread handling. i want to start and stop threads in dynamically. for example if i send an argument 5 it has to start 5 threads and it has to run for particular period of time and it has to automatically destroy when the time has to reach...... how to solve....... pls help me. its very urgent.....
Thanks in advance...
- 08-29-2008, 11:25 AM #2
Can you narrow your question somehow ? Now it sounds as a very common one and should be solved by reading Thread class documentation.
- 08-29-2008, 01:37 PM #3
The recommended way to stop a thread is for the thread itself to recognize the need to end and to exit. This would require that the thread be testing a flag to see if it is to exit.t has to automatically destroy when the time has to reach..
The stop method is deprecatd and not recommended.
- 08-29-2008, 02:50 PM #4
I'd say that testing flag is not quite modern technique. Usage of methods like Thread.sleep() or Object.wait() seems more preferable. If thread was interrupted exception is thrown.
- 08-29-2008, 04:56 PM #5
Sorry, don't see how using sleep in an thread that is doing something in a loop will necessarily react to an interrupt if the code is not in sleep when the interrupt is sent. Wouldn't the thread have to test to see if it was interrtupted? And if it never does a wait???
- 08-29-2008, 10:01 PM #6
Member
- Join Date
- Aug 2008
- Posts
- 1
- Rep Power
- 0
- 08-29-2008, 10:35 PM #7
Similar Threads
-
passing a value from parent thread to child thread
By sachinj13 in forum Threads and SynchronizationReplies: 7Last Post: 09-07-2008, 09:06 PM -
data from the main/GUI thread to another runnin thread...
By cornercuttin in forum Threads and SynchronizationReplies: 2Last Post: 04-23-2008, 10:30 PM -
If JNI thread call the java object in another thread, it will crash.
By skaterxu in forum Advanced JavaReplies: 0Last Post: 01-28-2008, 07:02 AM -
how to generate dynamic pdf
By valery in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 10:01 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks