Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 6e204a966e8c42d976f99a1700ce5f20 > files > 2278

ghc-7.4.2-4.mga5.i586.rpm

<!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.Marshal.Pool</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-Marshal-Pool.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>portable</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Maintainer</th><td>sven.panne@aedion.de</td></tr><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Foreign.Marshal.Pool</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Pool management
</a></li><li><a href="#g:2">(Re-)Allocation within a pool
</a></li><li><a href="#g:3">Combined allocation and marshalling
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>This module contains support for pooled memory management. Under this scheme,
 (re-)allocations belong to a given pool, and everything in a pool is
 deallocated when the pool itself is deallocated. This is useful when
 <code><a href="Foreign-Marshal-Alloc.html#v:alloca">alloca</a></code> with its implicit allocation and deallocation
 is not flexible enough, but explicit uses of <code><a href="Foreign-Marshal-Alloc.html#v:malloc">malloc</a></code>
 and <code><a href="Foreign-Marshal-Alloc.html#v:free">free</a></code> are too awkward.
</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"><span class="keyword">data</span>  <a href="#t:Pool">Pool</a> </li><li class="src short"><a href="#v:newPool">newPool</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a></li><li class="src short"><a href="#v:freePool">freePool</a> :: <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <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><li class="src short"><a href="#v:withPool">withPool</a> ::  (<a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="System-IO.html#t:IO">IO</a> b) -&gt; <a href="System-IO.html#t:IO">IO</a> b</li><li class="src short"><a href="#v:pooledMalloc">pooledMalloc</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledMallocBytes">pooledMallocBytes</a> ::  <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledRealloc">pooledRealloc</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledReallocBytes">pooledReallocBytes</a> ::  <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledMallocArray">pooledMallocArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledMallocArray0">pooledMallocArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledReallocArray">pooledReallocArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledReallocArray0">pooledReallocArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledNew">pooledNew</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; a -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledNewArray">pooledNewArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; [a] -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li><li class="src short"><a href="#v:pooledNewArray0">pooledNewArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; a -&gt; [a] -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</li></ul></div><div id="interface"><h1 id="g:1">Pool management
</h1><div class="top"><p class="src"><span class="keyword">data</span>  <a name="t:Pool" class="def">Pool</a>  </p><div class="doc"><p>A memory pool.
</p></div></div><div class="top"><p class="src"><a name="v:newPool" class="def">newPool</a> :: <a href="System-IO.html#t:IO">IO</a> <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a></p><div class="doc"><p>Allocate a fresh memory pool.
</p></div></div><div class="top"><p class="src"><a name="v:freePool" class="def">freePool</a> :: <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <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>Deallocate a memory pool and everything which has been allocated in the
 pool itself.
</p></div></div><div class="top"><p class="src"><a name="v:withPool" class="def">withPool</a> ::  (<a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="System-IO.html#t:IO">IO</a> b) -&gt; <a href="System-IO.html#t:IO">IO</a> b</p><div class="doc"><p>Execute an action with a fresh memory pool, which gets automatically
 deallocated (including its contents) after the action has finished.
</p></div></div><h1 id="g:2">(Re-)Allocation within a pool
</h1><div class="top"><p class="src"><a name="v:pooledMalloc" class="def">pooledMalloc</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate space for storable type in the given pool. The size of the area
 allocated is determined by the <code><a href="Foreign-Storable.html#v:sizeOf">sizeOf</a></code> method from the instance of
 <code><a href="Foreign-Storable.html#t:Storable">Storable</a></code> for the appropriate type.
</p></div></div><div class="top"><p class="src"><a name="v:pooledMallocBytes" class="def">pooledMallocBytes</a> ::  <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate the given number of bytes of storage in the pool.
</p></div></div><div class="top"><p class="src"><a name="v:pooledRealloc" class="def">pooledRealloc</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Adjust the storage area for an element in the pool to the given size of
 the required type.
</p></div></div><div class="top"><p class="src"><a name="v:pooledReallocBytes" class="def">pooledReallocBytes</a> ::  <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Adjust the storage area for an element in the pool to the given size.
</p></div></div><div class="top"><p class="src"><a name="v:pooledMallocArray" class="def">pooledMallocArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate storage for the given number of elements of a storable type in the
 pool.
</p></div></div><div class="top"><p class="src"><a name="v:pooledMallocArray0" class="def">pooledMallocArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate storage for the given number of elements of a storable type in the
 pool, but leave room for an extra element to signal the end of the array.
</p></div></div><div class="top"><p class="src"><a name="v:pooledReallocArray" class="def">pooledReallocArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Adjust the size of an array in the given pool.
</p></div></div><div class="top"><p class="src"><a name="v:pooledReallocArray0" class="def">pooledReallocArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; <a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a -&gt; <a href="Data-Int.html#t:Int">Int</a> -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Adjust the size of an array with an end marker in the given pool.
</p></div></div><h1 id="g:3">Combined allocation and marshalling
</h1><div class="top"><p class="src"><a name="v:pooledNew" class="def">pooledNew</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; a -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate storage for a value in the given pool and marshal the value into
 this storage.
</p></div></div><div class="top"><p class="src"><a name="v:pooledNewArray" class="def">pooledNewArray</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; [a] -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate consecutive storage for a list of values in the given pool and
 marshal these values into it.
</p></div></div><div class="top"><p class="src"><a name="v:pooledNewArray0" class="def">pooledNewArray0</a> :: <a href="Foreign-Storable.html#t:Storable">Storable</a> a =&gt; <a href="Foreign-Marshal-Pool.html#t:Pool">Pool</a> -&gt; a -&gt; [a] -&gt; <a href="System-IO.html#t:IO">IO</a> (<a href="Foreign-Ptr.html#t:Ptr">Ptr</a> a)</p><div class="doc"><p>Allocate consecutive storage for a list of values in the given pool and
 marshal these values into it, terminating the end with the given marker.
</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>