packages feed

mysql 0.2 → 0.2.0.1

raw patch · 3 files changed

+11/−2 lines, 3 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.2.0.1++* Make connection finalizer thread safe (#28).+ ## 0.2  * Remove obsolete `fieldDefault` from `data Field` (#41).
Database/MySQL/Base.hs view
@@ -85,6 +85,7 @@     ) where  import Control.Applicative ((<$>), (<*>))+import Control.Concurrent (rtsSupportsBoundThreads, runInBoundThread) import Control.Exception (Exception, throw) import Control.Monad (forM_, unless, when) import Data.ByteString.Char8 ()@@ -300,7 +301,11 @@         cleanupConnResult res         wasClosed <- atomicModifyIORef closed $ \prev -> (True, prev)         unless wasClosed $ mysql_close ptr-  fp <- newForeignPtr ptr realClose+  -- In general, the user of this library is responsible for dealing with thread+  -- safety. However, the programmer has no control over the OS thread+  -- finalizers are run from so we use 'runInBoundThread' and 'initThread' here.+  let myRunInBoundThread = if rtsSupportsBoundThreads then runInBoundThread else id+  fp <- newForeignPtr ptr (myRunInBoundThread $ initThread >> realClose)   return Connection {                connFP = fp              , connClose = realClose
mysql.cabal view
@@ -1,5 +1,5 @@ name:           mysql-version:        0.2+version:        0.2.0.1 homepage:       https://github.com/paul-rouse/mysql bug-reports:    https://github.com/paul-rouse/mysql/issues synopsis:       A low-level MySQL client library.