[3268] in java-interest

home help back first fref pref prev next nref lref last post

threading problem

daemon@ATHENA.MIT.EDU (WAVELL RUFUS SEATON)
Sun Nov 5 18:07:48 1995

Date: Sun, 5 Nov 1995 14:35:02 -0700
From: WAVELL RUFUS SEATON <wavell@columbus.Colorado.EDU>
To: java-interest@java.sun.com
Cc: wavell@columbus.Colorado.EDU

Hiya, I'm having some problems with threads.  I'm using the JDK to develop
some sorting demos (bigger and better than the existing demos). I run the
sorting algorithm in a thread, when the thread goes to sleep, I update
the display.  Anyhow, If I make the sorting thread a daemon thread it 
doesn't work! Thus my first question:

Q) What is the difference between daemon and non daemon threads other than
   that execution of a program will stop when all non daemon threads are
   finished?

I would also like to be able to kill the sorting thread. This happens if the
user wants to restart the demo, I want to kill the current version of the
sort thread, and then make a new one. I'm doing this in the handleEvent
method currently.. (that is I am trying to do it there, but its not working).
This leads to my second question:

Q) What is the recommended way to kill a thread that is executing? My thread
   makes calles to other threads. I would like to be able to kill the thread
   without waiting for the function call to return (if this is possible) and
   in another case I would like to wait for function calls to complete before
   the thread dies.

TIA, Bindu

(wavell@cs.colorado.edu)
http://ugrad-www.cs.colorado.edu/~wavell
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post