<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Foreign.Concurrent</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Foreign-Concurrent.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (requires concurrency)</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>ffi@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Foreign.Concurrent</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Concurrency-based <code><a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a></code> operations </a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>FFI datatypes and operations that use or require concurrency (GHC only). </p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:newForeignPtr">newForeignPtr</a> :: <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a> -> <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a> a)</li><li class="src short"><a href="#v:addForeignPtrFinalizer">addForeignPtrFinalizer</a> :: <a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a> -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li></ul></div><div id="interface"><h1 id="g:1">Concurrency-based <code><a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a></code> operations </h1><div class="doc"><p>These functions generalize their namesakes in the portable <a href="Foreign-ForeignPtr.html">Foreign.ForeignPtr</a> module by allowing arbitrary <code><a href="System-IO.html#t:IO">IO</a></code> actions as finalizers. These finalizers necessarily run in a separate thread, cf. <em>Destructors, Finalizers and Synchronization</em>, by Hans Boehm, <em>POPL</em>, 2003. </p></div><div class="top"><p class="src"><a name="v:newForeignPtr" class="def">newForeignPtr</a> :: <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a> -> <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a> a)</p><div class="doc"><p>Turns a plain memory reference into a foreign object by associating a finalizer - given by the monadic operation - with the reference. The finalizer will be executed after the last reference to the foreign object is dropped. There is no guarantee of promptness, and in fact there is no guarantee that the finalizer will eventually run at all. </p></div></div><div class="top"><p class="src"><a name="v:addForeignPtrFinalizer" class="def">addForeignPtrFinalizer</a> :: <a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a> a -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a> -> <a href="System-IO.html#t:IO">IO</a> <a href="../ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></p><div class="doc"><p>This function adds a finalizer to the given <code><a href="Foreign-ForeignPtr-Safe.html#t:ForeignPtr">ForeignPtr</a></code>. The finalizer will run after the last reference to the foreign object is dropped, but <em>before</em> all previously registered finalizers for the same object. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>