snapframework/snap-server — pull request #42 by basvandijk (2014-03-13 18:02:16+00:00)
Title: Label all threads and make sure they are killable

**Important:** this is a patch based of `0.9-stable`. It would be great if this could be released as a minor release in the 0.9 range. I would also gladly merge this into `master` if desired.

Hi Greg,

Labeling all threads ensures we can identify them when analyzing a GHC event log file using [ghc-events-analyze](http://www.well-typed.com/blog/86).

I also solve the current bug that all threads created by snap are unkillable when you start the server in a masked state. It is solved by using:

```haskell
forkIOWithUnmask $ \unmask -> unmask ...
```

so that asynchronous exception can always be delivered to the forked thread.

Here's an example of an analyzed event log file using the current labels:

![press-backend 1](https://f.cloud.github.com/assets/576355/2413013/57db0ca2-aad9-11e3-9e00-04173d4bd5c4.png)