diff options
| author | inari <inari@chalmers.se> | 2014-01-29 16:02:07 +0000 |
|---|---|---|
| committer | inari <inari@chalmers.se> | 2014-01-29 16:02:07 +0000 |
| commit | f0ddf0fe728ce147e8a54b3fa76ba00c50048a27 (patch) | |
| tree | 223c30ba755231d143c2727609445df82421027e /src/runtime/haskell-bind/Gu.hsc | |
| parent | 0386334f49fde8c5e4a5f438ae5cf9ed285e4579 (diff) | |
changes to pools in haskell bindings
Diffstat (limited to 'src/runtime/haskell-bind/Gu.hsc')
| -rw-r--r-- | src/runtime/haskell-bind/Gu.hsc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/runtime/haskell-bind/Gu.hsc b/src/runtime/haskell-bind/Gu.hsc index e9d060c92..20a728c79 100644 --- a/src/runtime/haskell-bind/Gu.hsc +++ b/src/runtime/haskell-bind/Gu.hsc @@ -9,6 +9,7 @@ import Foreign import Foreign.C import Foreign.C.String import Foreign.Ptr +import Control.Exception data GuEnum @@ -117,6 +118,10 @@ ptrToList appl arity = do let ptr = appl `plusPtr` (#offset PgfApplication, args) --args is not an argument, it's the actual field name sequence [peek (ptr `plusPtr` (i * (#size PgfExpr))) | i<-[0..arity-1]] - - +withGuPool :: (Ptr GuPool -> IO a) -> IO a +withGuPool f = do + pl <- gu_new_pool + f pl `finally` gu_pool_free pl + -- for true haskell persons + -- withGuPool f = bracket gu_new_pool gu_pool_free f |
