<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Netplex_intro.html"> <link rel="next" href="Netshm_data.html"> <link rel="Up" href="index.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of class attributes" rel=Appendix href="index_attributes.html"> <link title="Index of class methods" rel=Appendix href="index_methods.html"> <link title="Index of classes" rel=Appendix href="index_classes.html"> <link title="Index of class types" rel=Appendix href="index_class_types.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Uq_gtk" rel="Chapter" href="Uq_gtk.html"> <link title="Equeue" rel="Chapter" href="Equeue.html"> <link title="Unixqueue" rel="Chapter" href="Unixqueue.html"> <link title="Uq_engines" rel="Chapter" href="Uq_engines.html"> <link title="Uq_socks5" rel="Chapter" href="Uq_socks5.html"> <link title="Unixqueue_mt" rel="Chapter" href="Unixqueue_mt.html"> <link title="Equeue_intro" rel="Chapter" href="Equeue_intro.html"> <link title="Uq_ssl" rel="Chapter" href="Uq_ssl.html"> <link title="Uq_tcl" rel="Chapter" href="Uq_tcl.html"> <link title="Netcgi_common" rel="Chapter" href="Netcgi_common.html"> <link title="Netcgi" rel="Chapter" href="Netcgi.html"> <link title="Netcgi_ajp" rel="Chapter" href="Netcgi_ajp.html"> <link title="Netcgi_scgi" rel="Chapter" href="Netcgi_scgi.html"> <link title="Netcgi_cgi" rel="Chapter" href="Netcgi_cgi.html"> <link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html"> <link title="Netcgi_dbi" rel="Chapter" href="Netcgi_dbi.html"> <link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html"> <link title="Netcgi_test" rel="Chapter" href="Netcgi_test.html"> <link title="Netcgi_porting" rel="Chapter" href="Netcgi_porting.html"> <link title="Netcgi_plex" rel="Chapter" href="Netcgi_plex.html"> <link title="Http_client" rel="Chapter" href="Http_client.html"> <link title="Telnet_client" rel="Chapter" href="Telnet_client.html"> <link title="Ftp_data_endpoint" rel="Chapter" href="Ftp_data_endpoint.html"> <link title="Ftp_client" rel="Chapter" href="Ftp_client.html"> <link title="Nethttpd_types" rel="Chapter" href="Nethttpd_types.html"> <link title="Nethttpd_kernel" rel="Chapter" href="Nethttpd_kernel.html"> <link title="Nethttpd_reactor" rel="Chapter" href="Nethttpd_reactor.html"> <link title="Nethttpd_engine" rel="Chapter" href="Nethttpd_engine.html"> <link title="Nethttpd_services" rel="Chapter" href="Nethttpd_services.html"> <link title="Nethttpd_plex" rel="Chapter" href="Nethttpd_plex.html"> <link title="Nethttpd_intro" rel="Chapter" href="Nethttpd_intro.html"> <link title="Netplex_types" rel="Chapter" href="Netplex_types.html"> <link title="Netplex_mp" rel="Chapter" href="Netplex_mp.html"> <link title="Netplex_mt" rel="Chapter" href="Netplex_mt.html"> <link title="Netplex_log" rel="Chapter" href="Netplex_log.html"> <link title="Netplex_controller" rel="Chapter" href="Netplex_controller.html"> <link title="Netplex_container" rel="Chapter" href="Netplex_container.html"> <link title="Netplex_sockserv" rel="Chapter" href="Netplex_sockserv.html"> <link title="Netplex_workload" rel="Chapter" href="Netplex_workload.html"> <link title="Netplex_main" rel="Chapter" href="Netplex_main.html"> <link title="Netplex_config" rel="Chapter" href="Netplex_config.html"> <link title="Netplex_kit" rel="Chapter" href="Netplex_kit.html"> <link title="Rpc_netplex" rel="Chapter" href="Rpc_netplex.html"> <link title="Netplex_cenv" rel="Chapter" href="Netplex_cenv.html"> <link title="Netplex_intro" rel="Chapter" href="Netplex_intro.html"> <link title="Netshm" rel="Chapter" href="Netshm.html"> <link title="Netshm_data" rel="Chapter" href="Netshm_data.html"> <link title="Netshm_hashtbl" rel="Chapter" href="Netshm_hashtbl.html"> <link title="Netshm_array" rel="Chapter" href="Netshm_array.html"> <link title="Netshm_intro" rel="Chapter" href="Netshm_intro.html"> <link title="Netconversion" rel="Chapter" href="Netconversion.html"> <link title="Netchannels" rel="Chapter" href="Netchannels.html"> <link title="Netstream" rel="Chapter" href="Netstream.html"> <link title="Mimestring" rel="Chapter" href="Mimestring.html"> <link title="Netmime" rel="Chapter" href="Netmime.html"> <link title="Netsendmail" rel="Chapter" href="Netsendmail.html"> <link title="Neturl" rel="Chapter" href="Neturl.html"> <link title="Netaddress" rel="Chapter" href="Netaddress.html"> <link title="Netbuffer" rel="Chapter" href="Netbuffer.html"> <link title="Netdate" rel="Chapter" href="Netdate.html"> <link title="Netencoding" rel="Chapter" href="Netencoding.html"> <link title="Netulex" rel="Chapter" href="Netulex.html"> <link title="Netaccel" rel="Chapter" href="Netaccel.html"> <link title="Netaccel_link" rel="Chapter" href="Netaccel_link.html"> <link title="Nethtml" rel="Chapter" href="Nethtml.html"> <link title="Netstring_str" rel="Chapter" href="Netstring_str.html"> <link title="Netstring_pcre" rel="Chapter" href="Netstring_pcre.html"> <link title="Netstring_mt" rel="Chapter" href="Netstring_mt.html"> <link title="Netmappings" rel="Chapter" href="Netmappings.html"> <link title="Netaux" rel="Chapter" href="Netaux.html"> <link title="Nethttp" rel="Chapter" href="Nethttp.html"> <link title="Netchannels_tut" rel="Chapter" href="Netchannels_tut.html"> <link title="Netmime_tut" rel="Chapter" href="Netmime_tut.html"> <link title="Netsendmail_tut" rel="Chapter" href="Netsendmail_tut.html"> <link title="Netulex_tut" rel="Chapter" href="Netulex_tut.html"> <link title="Neturl_tut" rel="Chapter" href="Neturl_tut.html"> <link title="Netsys" rel="Chapter" href="Netsys.html"> <link title="Netpop" rel="Chapter" href="Netpop.html"> <link title="Rpc_auth_dh" rel="Chapter" href="Rpc_auth_dh.html"> <link title="Rpc_key_service" rel="Chapter" href="Rpc_key_service.html"> <link title="Rpc_time" rel="Chapter" href="Rpc_time.html"> <link title="Rpc_auth_local" rel="Chapter" href="Rpc_auth_local.html"> <link title="Rtypes" rel="Chapter" href="Rtypes.html"> <link title="Xdr" rel="Chapter" href="Xdr.html"> <link title="Rpc" rel="Chapter" href="Rpc.html"> <link title="Rpc_program" rel="Chapter" href="Rpc_program.html"> <link title="Rpc_portmapper_aux" rel="Chapter" href="Rpc_portmapper_aux.html"> <link title="Rpc_packer" rel="Chapter" href="Rpc_packer.html"> <link title="Rpc_transport" rel="Chapter" href="Rpc_transport.html"> <link title="Rpc_client" rel="Chapter" href="Rpc_client.html"> <link title="Rpc_simple_client" rel="Chapter" href="Rpc_simple_client.html"> <link title="Rpc_portmapper_clnt" rel="Chapter" href="Rpc_portmapper_clnt.html"> <link title="Rpc_portmapper" rel="Chapter" href="Rpc_portmapper.html"> <link title="Rpc_server" rel="Chapter" href="Rpc_server.html"> <link title="Rpc_auth_sys" rel="Chapter" href="Rpc_auth_sys.html"> <link title="Rpc_intro" rel="Chapter" href="Rpc_intro.html"> <link title="Rpc_mapping_ref" rel="Chapter" href="Rpc_mapping_ref.html"> <link title="Rpc_ssl" rel="Chapter" href="Rpc_ssl.html"> <link title="Rpc_xti_client" rel="Chapter" href="Rpc_xti_client.html"> <link title="Shell_sys" rel="Chapter" href="Shell_sys.html"> <link title="Shell" rel="Chapter" href="Shell.html"> <link title="Shell_uq" rel="Chapter" href="Shell_uq.html"> <link title="Shell_mt" rel="Chapter" href="Shell_mt.html"> <link title="Shell_intro" rel="Chapter" href="Shell_intro.html"> <link title="Netsmtp" rel="Chapter" href="Netsmtp.html"><link title="Shared Memory Descriptors" rel="Section" href="#1_SharedMemoryDescriptors"> <link title="Shared Memory Tables" rel="Section" href="#1_SharedMemoryTables"> <link title="Enhanced API to shared memory tables" rel="Section" href="#1_EnhancedAPItosharedmemorytables"> <title>Ocamlnet 2 Reference Manual : Netshm</title> </head> <body> <div class="navbar"><a href="Netplex_intro.html">Previous</a> <a href="index.html">Up</a> <a href="Netshm_data.html">Next</a> </div> <center><h1>Module <a href="type_Netshm.html">Netshm</a></h1></center> <br> <pre><span class="keyword">module</span> Netshm: <code class="code">sig</code> <a href="Netshm.html">..</a> <code class="code">end</code></pre>Shared memory for O'Caml programs using multi-processing<br> <hr width="100%"> <br> <a name="1_SharedMemoryDescriptors"></a> <h1>Shared Memory Descriptors</h1><br> <pre><span class="keyword">type</span> <a name="TYPEshm_descr"></a><code class="type"></code>shm_descr </pre> <div class="info"> A shared memory descriptor refers to a shared memory object. Such a descriptor must only be opened once for every process.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEshm_type"></a><code class="type"></code>shm_type = <code class="type">[ `File | `POSIX ]</code> </pre> <pre><span class="keyword">val</span> <a name="VALsupported_types"></a>supported_types : <code class="type"><a href="Netshm.html#TYPEshm_type">shm_type</a> list</code></pre><div class="info"> The types supported for this OS<br> </div> <pre><span class="keyword">type</span> <a name="TYPEshm_name"></a><code class="type"></code>shm_name = <code class="type">[ `File of string | `POSIX of string ]</code> </pre> <div class="info"> A <code class="code">shm_name</code> is a name for a shared memory object.<br> </div> <pre><span class="keyword">val</span> <a name="VALshm_type_of_name"></a>shm_type_of_name : <code class="type"><a href="Netshm.html#TYPEshm_name">shm_name</a> -> <a href="Netshm.html#TYPEshm_type">shm_type</a></code></pre><pre><span class="keyword">val</span> <a name="VALopen_shm"></a>open_shm : <code class="type"><a href="Netshm.html#TYPEshm_name">shm_name</a> -> Unix.open_flag list -> int -> <a href="Netshm.html#TYPEshm_descr">shm_descr</a></code></pre><div class="info"> Opens the shared memory object. <p> For <code class="code">POSIX_shm</code> not all open flags can be specified. The flags are limited to <code class="code">O_RDONLY</code>, <code class="code">O_RDWR</code>, <code class="code">O_CREAT</code>, <code class="code">O_EXCL</code> and <code class="code">O_TRUNC</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALcreate_unique_shm"></a>create_unique_shm : <code class="type"><a href="Netshm.html#TYPEshm_name">shm_name</a> -> int -> <a href="Netshm.html#TYPEshm_descr">shm_descr</a></code></pre><div class="info"> Create a shared memory object under a name that is derived from the passed <code class="code">shm_name</code>. The actual name can be queried with <code class="code">name_of_shm</code> (below). <p> For <code class="code">POSIX</code> and <code class="code">File</code> names, deriving works by replacing the 'X' letters in the file name by random digits and letters. For example, if the name is <code class="code">File "/my/directory/ocaml.XXXXXX"</code> six random characters are generated and replace the 'X' letters such that the file is unique. <p> The integer is the file permission.<br> </div> <pre><span class="keyword">val</span> <a name="VALname_of_shm"></a>name_of_shm : <code class="type"><a href="Netshm.html#TYPEshm_descr">shm_descr</a> -> <a href="Netshm.html#TYPEshm_name">shm_name</a></code></pre><div class="info"> Returns the name of an object<br> </div> <pre><span class="keyword">val</span> <a name="VALclose_shm"></a>close_shm : <code class="type"><a href="Netshm.html#TYPEshm_descr">shm_descr</a> -> unit</code></pre><div class="info"> Closes the object. The object remains existent and can be opened again.<br> </div> <pre><span class="keyword">val</span> <a name="VALunlink_shm"></a>unlink_shm : <code class="type"><a href="Netshm.html#TYPEshm_name">shm_name</a> -> unit</code></pre><div class="info"> Removes the name permanently from the system<br> </div> <pre><span class="keyword">val</span> <a name="VALchmod_shm"></a>chmod_shm : <code class="type"><a href="Netshm.html#TYPEshm_descr">shm_descr</a> -> int -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALchown_shm"></a>chown_shm : <code class="type"><a href="Netshm.html#TYPEshm_descr">shm_descr</a> -> int -> int -> unit</code></pre><div class="info"> Set file permission bits, user and group ownership of the object<br> </div> <pre><span class="keyword">type</span> <a name="TYPElocking_method"></a><code class="type"></code>locking_method = <code class="type">[ `No_locking | `Record_locking ]</code> </pre> <div class="info"> The locking method is used to ensure that parallel read and write operations to the memory object do not interfer with each other. If <code class="code">No_locking</code> is selected, such protection is not done - this is ok if only read accesses occur or if the user can ensure that never a write access is done in parallel with another access. The locking method must be compatible with the type of shared memory.<br> </div> <pre><span class="keyword">val</span> <a name="VALbest_locking_method"></a>best_locking_method : <code class="type"><a href="Netshm.html#TYPEshm_type">shm_type</a> -> <a href="Netshm.html#TYPElocking_method">locking_method</a></code></pre><div class="info"> Return the best locking method other than <code class="code">No_locking</code><br> </div> <br> <a name="1_SharedMemoryTables"></a> <h1>Shared Memory Tables</h1><br> <br> This is a quite basic data structure implemented for shared memory: hash tables with <code class="code">int32</code> as key and one-dimensional <code class="code">int32</code> bigarray as values.<br> <br> The semantics resembles the <code class="code">Hashtbl</code> of stdlib<br> <pre><span class="keyword">type</span> <a name="TYPEshm_table"></a><code class="type"></code>shm_table </pre> <pre><span class="keyword">type</span> <a name="TYPEint32_array"></a><code class="type"></code>int32_array = <code class="type">(int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array1.t</code> </pre> <pre><span class="keyword">exception</span> <a name="EXCEPTIONCorrupt_file"></a>Corrupt_file <span class="keyword">of</span> <code class="type">string</code></pre> <div class="info"> Raised when a violation of the object format is detected<br> </div> <pre><span class="keyword">exception</span> <a name="EXCEPTIONDeadlock"></a>Deadlock</pre> <div class="info"> Raised when a deadlock situation was detected. Deadlocks can occur when the <code class="code">group</code> function is used<br> </div> <pre><span class="keyword">val</span> <a name="VALmanage"></a>manage : <code class="type">?pagesize:int -><br> ?init:int -> <a href="Netshm.html#TYPElocking_method">locking_method</a> -> <a href="Netshm.html#TYPEshm_descr">shm_descr</a> -> <a href="Netshm.html#TYPEshm_table">shm_table</a></code></pre><div class="info"> Starts managing an open shared memory object as <code class="code">shm_table</code>. If the object is empty, it is automatically enlarged to the minimum size and initialized. If the object is non-empty it is expected that it already contains a valid <code class="code">shm_table</code> structure. <p> The object automatically grows in size when new elements are added to the object. By removing elements, however, the object is never shrinked. Unused memory is held back for later reallocation by the same <code class="code">shm_table</code>. <p> By default, the table uses a page size of 256 bytes. The page size is the unit of memory allocation. The parameter <code class="code">pagesize</code> overrides this default. The page size must be at least 160 and divisible by 4. The page size must be the same when the table was created. <p> By passing <code class="code">init</code> it is enforced that the table is re-initialized (deleted and again created). The argument of <code class="code">init</code> is a hint for the number of elements the table will contain. The data structure is then created such that this many elements can be added without needing expensive data reorganization.<br> </div> <pre><span class="keyword">val</span> <a name="VALgroup"></a>group : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> ('a -> 'b) -> 'a -> 'b</code></pre><div class="info"> Execute a sequence of operations in a group: <p> <pre><code class="code"> let r = group table (fun arg -> operation1; operation2; ...) arg </code></pre> <p> Operations can be any reading or writing functions from below. The effect is that the locking requirements of the operations are merged, so that no operation of another process can interfer with the grouped sequence. Note, however, that this gives no real atomicity as there is no way to roll back half-executed sequences. <p> Groups can be nested. <p> An example of <code class="code">group</code> is to set a binding depending on the previous value of the binding. Here, we add 1: <p> <pre><code class="code"> let add_one table = group table (fun key -> let ba = try find table key with Not_found -> Bigarray.Array1.create Bigarray.int32 Bigarray.c_layout 1 in ba.{ 0 } <- Int32.succ ba.{ 0 }; replace table key ba ) </code></pre> <p> Grouping protects the update from modifications done by other processes at the same time. In particular, without grouping it can happen that another process also modifies the same value between <code class="code">find</code> and <code class="code">replace</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd"></a>add : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a> -> unit</code></pre><div class="info"> <code class="code">add tbl key value</code>: Adds the binding of <code class="code">key</code> to <code class="code">value</code> to the table. Previous bindings are not removed, but simply hidden.<br> </div> <pre><span class="keyword">val</span> <a name="VALfind"></a>find : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a></code></pre><div class="info"> <code class="code">find tbl key</code>: Finds the current binding of <code class="code">key</code> in <code class="code">tbl</code> or raises <code class="code">Not_found</code> if no such binding exists.<br> </div> <pre><span class="keyword">val</span> <a name="VALfind_all"></a>find_all : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a> list</code></pre><div class="info"> <code class="code">find_all tbl key</code> returns the list of all data associated with <code class="code">key</code> in <code class="code">tbl</code>. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.<br> </div> <pre><span class="keyword">val</span> <a name="VALmem"></a>mem : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> bool</code></pre><div class="info"> <code class="code">mem tbl key</code> checks if <code class="code">key</code> is bound in <code class="code">tbl</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove"></a>remove : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> unit</code></pre><div class="info"> <code class="code">remove tbl key</code> removes the current binding of <code class="code">key</code> in <code class="code">tbl</code>, restoring the previous binding if it exists. It does nothing if <code class="code">key</code> is not bound in <code class="code">tbl</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALreplace"></a>replace : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a> -> unit</code></pre><div class="info"> <code class="code">replace tbl key value</code> replaces the current binding of <code class="code">key</code> in <code class="code">tbl</code> by a binding of <code class="code">key</code> to <code class="code">value</code>. If <code class="code">key</code> is unbound in <code class="code">tbl</code>, a binding of <code class="code">key</code> to <code class="code">value</code> is added to <code class="code">tbl</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALiter"></a>iter : <code class="type">(int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a> -> unit) -> <a href="Netshm.html#TYPEshm_table">shm_table</a> -> unit</code></pre><div class="info"> <code class="code">iter f tbl</code> applies <code class="code">f</code> to all bindings in table <code class="code">tbl</code>. <code class="code">f</code> receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to <code class="code">f</code>. The order in which the bindings are passed to <code class="code">f</code> is unspecified. However, if the table contains several bindings for the same key, they are passed to <code class="code">f</code> in reverse order of introduction, that is, the most recent binding is passed first. <p> While the iteration is in progress, the table is read-locked. That means you cannot modify it during the iteration.<br> </div> <pre><span class="keyword">val</span> <a name="VALiter_keys"></a>iter_keys : <code class="type">(int32 -> unit) -> <a href="Netshm.html#TYPEshm_table">shm_table</a> -> unit</code></pre><div class="info"> <code class="code">iter_keys f tbl</code> applies <code class="code">f</code> to all keys in table <code class="code">tbl</code>. If there are several bindings for a key, <code class="code">f</code> is only called once. <p> While the iteration is in progress, the table is locked. That means you cannot modify it during the iteration.<br> </div> <pre><span class="keyword">val</span> <a name="VALfold"></a>fold : <code class="type">(int32 -> <a href="Netshm.html#TYPEint32_array">int32_array</a> -> 'a -> 'a) -> <a href="Netshm.html#TYPEshm_table">shm_table</a> -> 'a -> 'a</code></pre><div class="info"> <code class="code">fold f tbl init</code> computes <code class="code">(f kN dN ... (f k1 d1 init)...)</code>, where <code class="code">k1 ... kN</code> are the keys of all bindings in <code class="code">tbl</code>, and <code class="code">d1 ... dN</code> are the associated values. Each binding is presented exactly once to <code class="code">f</code>. The order in which the bindings are passed to <code class="code">f</code> is unspecified. However, if the table contains several bindings for the same key, they are passed to <code class="code">f</code> in reverse order of introduction, that is, the most recent binding is passed first. <p> While the iteration is in progress, the table is locked. That means you cannot modify it during the iteration.<br> </div> <pre><span class="keyword">val</span> <a name="VALlength"></a>length : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int</code></pre><div class="info"> <code class="code">length tbl</code> returns the number of bindings in <code class="code">tbl</code>. Multiple bindings are counted multiply, so <code class="code">length</code> gives the number of times <code class="code">iter</code> calls its first argument.<br> </div> <br> <a name="1_EnhancedAPItosharedmemorytables"></a> <h1>Enhanced API to shared memory tables</h1><br> <pre><span class="keyword">exception</span> <a name="EXCEPTIONNext"></a>Next</pre> <pre><span class="keyword">exception</span> <a name="EXCEPTIONBreak"></a>Break</pre> <pre><span class="keyword">val</span> <a name="VALread_blocks"></a>read_blocks : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> int32 -> (<a href="Netshm.html#TYPEint32_array">int32_array</a> option -> unit) -> unit</code></pre><div class="info"> <code class="code">find_blocks tbl key f</code>: The values may be stored in several disk blocks. This interface allows one to access the values block by block. As <code class="code">find_all</code>, all bindings for <code class="code">key</code> in <code class="code">tbl</code> are determined in reverse order, i.e. the newest binding first, the oldest last. For every binding <code class="code">value</code>, the function <code class="code">f</code> is invoked in a sequence <code class="code">f (Some v1)</code>, <code class="code">f (Some v2)</code>, ..., <code class="code">f (Some vN)</code>, <code class="code">f None</code> where <code class="code">value</code> is the array concatenation of <code class="code">v1</code>, <code class="code">v2</code>, ..., <code class="code">vN</code>. The function <code class="code">f</code> may raise the exception <code class="code">Next</code> to go directly to the start of the next binding of <code class="code">key</code>. The exception <code class="code">Break</code> stops the iteration immediately. <p> Note that the <code class="code">int32_array</code> fragments <code class="code">vK</code> point to shared memory. Any assignment would modify the shared memory object directly! The binding is at that time, however, only read-locked, so this should be avoided.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEwrite_op"></a><code class="type"></code>write_op = <code class="type">[ `Remove_binding ]</code> </pre> <pre><span class="keyword">type</span> <a name="TYPEctrl_op"></a><code class="type"></code>ctrl_op = <code class="type">[ `Nop | `Remove_binding ]</code> </pre> <pre><span class="keyword">val</span> <a name="VALwrite_blocks"></a>write_blocks : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -><br> <a href="Netshm.html#TYPEwrite_op">write_op</a> list -><br> int32 -> (<a href="Netshm.html#TYPEint32_array">int32_array</a> option -> <a href="Netshm.html#TYPEctrl_op">ctrl_op</a>) -> unit</code></pre><div class="info"> <code class="code">write_blocks tbl ops key f</code>: Like <code class="code">read_blocks</code> this function iterates over the blocks of all bindings for <code class="code">key</code>. For every binding <code class="code">value</code>, the function <code class="code">f</code> is invoked in a sequence <code class="code">f (Some v1)</code>, <code class="code">f (Some v2)</code>, ..., <code class="code">f (Some vN)</code>, <code class="code">f None</code>. Unlike <code class="code">read_blocks</code> the function <code class="code">f</code> returns a value. The last non-<code class="code">`Nop</code> result value in this sequence determines the modification to carry out for the binding: <p> <ul> <li><code class="code">`Remove_binding</code>: The whole binding is removed from the table.</li> </ul> If all invocations of <code class="code">f</code> just return <code class="code">`Nop</code>, no further modification is done. <p> The modifications must be announced in the <code class="code">ops</code> argument. It is not allowed that <code class="code">f</code> returns a value not being a member of <code class="code">ops</code> (except <code class="code">`Nop</code>). <p> It is possible to raise the special exceptions <code class="code">Next</code> and <code class="code">Break</code> just as for <code class="code">read_blocks</code>. <p> Note that the <code class="code">int32_array</code> fragments <code class="code">vK</code> point to shared memory. Any assignment will modify the shared memory object directly! The binding is at that time write-locked, so such assignments are protected against concurrent writes.<br> </div> <pre><span class="keyword">val</span> <a name="VALdump"></a>dump : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALbigarray"></a>bigarray : <code class="type">int array -> <a href="Netshm.html#TYPEint32_array">int32_array</a></code></pre><pre><span class="keyword">val</span> <a name="VALmemory"></a>memory : <code class="type"><a href="Netshm.html#TYPEshm_table">shm_table</a> -><br> (int32, Bigarray.int32_elt, Bigarray.c_layout) Bigarray.Array2.t</code></pre></body></html>