Daemon Threads
David
d at dav1d.de
Tue Aug 7 09:36:46 PDT 2012
I have a threaded connection:
class ThreadedConnection : Connection {
protected Thread _thread = null;
@property Thread thread() { return _thread; }
void run() {
if(_thread is null) {
_thread = new Thread(&(super.run));
_thread.isDaemon = true;
}
_thread.start();
}
}
The thread will call &super.run:
void run() {
while(_connected) {
poll();
}
}
Since this is a daemon thread, I'd expect it to stop/terminate when the
main thread stops. This is not the case (it keeps running), is this a
known bug and how can I workaround this?
It also seems that it keeps running, even if I close the connection and
super.run stops.
More information about the Digitalmars-d-learn
mailing list