2

I am looking at using wai/warp for some custom interprocess communications. This would have the unusual requirement that I would need to start/stop warp instances dynamically within a process. The main issue seems to be cleanly stopping warp. This question is addressed here:

How do I implement a shutdown command in a WAI server?

but the suggested solution end up exiting the process by returning from main. Can I just throw a ThreadKill exception to the warp thread?

This thread:

https://groups.google.com/forum/#!topic/yesodweb/VoenrabRUBQ

suggests that an IORef could be passed on startup, which could trigger a shutdown externally. This sounds ideal, but isn't part of the current API.

Community
  • 1
  • 1
timbod
  • 791
  • 5
  • 16

1 Answers1

3

You can run Warp in a separate thread via forkIO and then kill that thread only.

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • That is what I am doing currently. Can I rely on the internals of warp being cleaned up correctly? – timbod Apr 08 '13 at 12:07