mongodb/Database/MongoDB
Arnaud Spiwack bd25f8bee3 Unmask the forked thread in newPipeline
The `newPipeline` function, used as part of `connect`, forks a
listener thread. Before this commit, the thread is forked with
`forkFinally`, where the thread action is run in the same mask as the
parent thread. The thread is then killed by a `killThread` when
closing a connection.

This is typically not a problem if the mask is “masked” (or,
obviously, “unmasked”), because the listener is generally blocked on a
channel at some time or other, and therefore will accept the
asynchronous exception thrown by `killThread`, and terminate.

However, if the mask is “masked uninterruptible”, then the listener
definitely doesn't receive asynchronous exceptions, and the
`killThread` calls hangs, and never returns.

One should probably never call `connect` in a “masked uninterruptible”
action. However, it sounds better to protect the mongoDB library
against the user accidentally doing so than to add a big warning
saying that calling `connect` in “masked uninterruptible” will cause
the program to hang down the line.

Therefore, this commit uses `forkIOWithUnmask`, in order to run the
thread action always in an “unmasked” state. In which case we can be
sure that we can always kill the listener thread regardless of the
client code.
2019-10-29 09:49:44 +01:00
..
Internal Unmask the forked thread in newPipeline 2019-10-29 09:49:44 +01:00
Transport Add module Database.MongoDB.Internal.Network. 2019-05-29 18:02:37 -07:00
Admin.hs Drop MonadBaseControl from two more modules 2017-05-11 21:35:41 -07:00
Connection.hs Add module Database.MongoDB.Internal.Network. 2019-05-29 18:02:37 -07:00
GridFS.hs Revert "Remove use of conduit Producer and Consumer." 2019-05-29 17:18:00 -07:00
Query.hs Use Control.Monad.Except instead of Control.Monad.Error. 2019-05-29 16:57:51 -07:00
Transport.hs Add documentation for Transport module 2016-06-21 02:19:02 -07:00