Added shutdown capability
This commit is contained in:
parent
5f16e8d5b0
commit
bfa4364a99
|
@ -115,5 +115,11 @@ public final class Manager
|
|||
public void shutdown()
|
||||
{
|
||||
/* 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 */
|
||||
private Socket socket;
|
||||
|
||||
// private bool running;
|
||||
|
||||
this(Manager manager, Socket endpoint)
|
||||
{
|
||||
super(&run);
|
||||
this.manager = manager;
|
||||
socket = endpoint;
|
||||
|
||||
// running = true;
|
||||
start();
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
/* Close the socket, causing an error, breaking the event loop */
|
||||
socket.close();
|
||||
}
|
||||
|
||||
private void run()
|
||||
{
|
||||
/* Continuously dequeue tristanable packets from socket */
|
||||
|
|
Loading…
Reference in New Issue