Added shutdown capability
This commit is contained in:
parent
5f16e8d5b0
commit
bfa4364a99
|
@ -115,5 +115,11 @@ public final class Manager
|
||||||
public void shutdown()
|
public void shutdown()
|
||||||
{
|
{
|
||||||
/* TODO: Implement me */
|
/* TODO: Implement me */
|
||||||
|
|
||||||
|
/* Make the loop stop whenever it does */
|
||||||
|
watcher.shutdown();
|
||||||
|
|
||||||
|
/* Wait for the thread to end */
|
||||||
|
watcher.join();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,15 +17,24 @@ public final class Watcher : Thread
|
||||||
/* The socket to read from */
|
/* The socket to read from */
|
||||||
private Socket socket;
|
private Socket socket;
|
||||||
|
|
||||||
|
// private bool running;
|
||||||
|
|
||||||
this(Manager manager, Socket endpoint)
|
this(Manager manager, Socket endpoint)
|
||||||
{
|
{
|
||||||
super(&run);
|
super(&run);
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
socket = endpoint;
|
socket = endpoint;
|
||||||
|
|
||||||
|
// running = true;
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shutdown()
|
||||||
|
{
|
||||||
|
/* Close the socket, causing an error, breaking the event loop */
|
||||||
|
socket.close();
|
||||||
|
}
|
||||||
|
|
||||||
private void run()
|
private void run()
|
||||||
{
|
{
|
||||||
/* Continuously dequeue tristanable packets from socket */
|
/* Continuously dequeue tristanable packets from socket */
|
||||||
|
|
Loading…
Reference in New Issue