Reputation: 3352
I'm using network-simple
in my project. I would like my function, gateway
, to return a few functions in a tuple -- one of which will be shutdown
-- a function to boot all the clients and shutdown the server.
If gateway
produces many forks using Network.Simple.serve
, what's the best way to implement shutdown
?
I could implement it using TVar
to indicate the server is shutting down, but polling would be a suboptimal solution in my opinion.
Upvotes: 0
Views: 86
Reputation: 137947
There are many ways. Somehow you need a control channel to the server, and that control channel accepts at least one message, "Shutdown".
You could do this with:
Upvotes: 4