Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 19a466aa43e0f0793b72d6a6c3524ff5 > files > 50

ocaml-async_unix-devel-109.24.00-2.mga4.x86_64.rpm

<!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="Interruptor.html">
<link rel="next" href="Io_stats.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 modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Async_print" rel="Chapter" href="Async_print.html">
<link title="Async_sys" rel="Chapter" href="Async_sys.html">
<link title="Epoll_file_descr_watcher" rel="Chapter" href="Epoll_file_descr_watcher.html">
<link title="Fd" rel="Chapter" href="Fd.html">
<link title="Fd_by_descr" rel="Chapter" href="Fd_by_descr.html">
<link title="File_descr_watcher_intf" rel="Chapter" href="File_descr_watcher_intf.html">
<link title="Import" rel="Chapter" href="Import.html">
<link title="Interruptor" rel="Chapter" href="Interruptor.html">
<link title="In_thread" rel="Chapter" href="In_thread.html">
<link title="Io_stats" rel="Chapter" href="Io_stats.html">
<link title="Process" rel="Chapter" href="Process.html">
<link title="Raw_fd" rel="Chapter" href="Raw_fd.html">
<link title="Raw_scheduler" rel="Chapter" href="Raw_scheduler.html">
<link title="Raw_signal_manager" rel="Chapter" href="Raw_signal_manager.html">
<link title="Reader" rel="Chapter" href="Reader.html">
<link title="Read_write" rel="Chapter" href="Read_write.html">
<link title="Scheduler" rel="Chapter" href="Scheduler.html">
<link title="Select_file_descr_watcher" rel="Chapter" href="Select_file_descr_watcher.html">
<link title="Shutdown" rel="Chapter" href="Shutdown.html">
<link title="Signal" rel="Chapter" href="Signal.html">
<link title="Signal_manager" rel="Chapter" href="Signal_manager.html">
<link title="Std" rel="Chapter" href="Std.html">
<link title="Syscall" rel="Chapter" href="Syscall.html">
<link title="Thread_pool" rel="Chapter" href="Thread_pool.html">
<link title="Thread_safe" rel="Chapter" href="Thread_safe.html">
<link title="Thread_safe_pipe" rel="Chapter" href="Thread_safe_pipe.html">
<link title="Unix_syscalls" rel="Chapter" href="Unix_syscalls.html">
<link title="Writer" rel="Chapter" href="Writer.html"><title>In_thread</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Interruptor.html" title="Interruptor">Previous</a>
&nbsp;<a class="up" href="index.html" title="Index">Up</a>
&nbsp;<a class="post" href="Io_stats.html" title="Io_stats">Next</a>
</div>
<h1>Module <a href="type_In_thread.html">In_thread</a></h1>

<pre><span class="keyword">module</span> In_thread: <code class="code">sig</code> <a href="In_thread.html">..</a> <code class="code">end</code></pre><div class="info module top">
The <code class="code">In_thread</code> module has functions for interaction between the Async world and other
    (kernel) threads.  The name is to remind us to think about threads and race
    conditions.<br>
</div>
<hr width="100%">

<pre><span class="keyword">module</span> <a href="In_thread.Priority.html">Priority</a>: <code class="type">module type of Linux_ext.Priority</code><code class="type">  with type t = Linux_ext.Priority.t</code></pre>
<pre><span class="keyword">module</span> <a href="In_thread.Helper_thread.html">Helper_thread</a>: <code class="code">sig</code> <a href="In_thread.Helper_thread.html">..</a> <code class="code">end</code></pre>
<pre><span id="VALpipe_of_squeue"><span class="keyword">val</span> pipe_of_squeue</span> : <code class="type">'a Core.Std.Squeue.t -> 'a Async_core.Pipe.Reader.t</code></pre><div class="info ">
<code class="code">pipe_of_squeue squeue</code> returns a pipe <code class="code">p</code> and consumes the contents <code class="code">squeue</code>, placing
    them in <code class="code">p</code>.  It repeatedly grabs everything from <code class="code">squeue</code>, places it in <code class="code">p</code>, and
    then waits for pushback on <code class="code">p</code>.<br>
</div>

<pre><span id="VALrun"><span class="keyword">val</span> run</span> : <code class="type">?priority:Priority.t -><br>       ?thread:<a href="In_thread.Helper_thread.html#TYPEt">Helper_thread.t</a> -><br>       ?name:string -> (unit -> 'a) -> 'a Async_core.Deferred.t</code></pre><div class="info ">
<code class="code">run ?priority ?thread ?name f</code> runs <code class="code">f ()</code> in another thread and returns the result
    as a Deferred in the Async world.  If <code class="code">f ()</code> raises an exception (asynchronously,
    since it is another thread) then that exception will be raised to the monitor that
    called <code class="code">run</code>.
<p>

    Async code should not be used from within <code class="code">f</code>.
<p>

    If <code class="code">thread</code> is not supplied, then any thread from the thread pool could be used.  If
    you need to run routines in a specific thread (as is required by some libraries like
    Sqlite), you should create a helper thread and supply it to <code class="code">run</code>.
<p>

    If <code class="code">priority</code> is supplied, the priority of the thread in the linux scheduler will be
    set to <code class="code">priority</code> for the duration of <code class="code">f ()</code>, provided the thread is allowed to do so,
    see `man setpriority`.
<p>

    If you call <code class="code">run</code> several times with the same helper thread, the <code class="code">f ()</code> calls will run
    in sequence, in the order in which they are supplied to <code class="code">run</code>.  Each <code class="code">f ()</code> will
    complete (return or raise) before another <code class="code">f ()</code> starts.
<p>

    For example, if you do:
<p>

    <pre class="codepre"><code class="code">      let () =
        run ~thread f1;
        run ~thread f2;
        run ~thread f3;
    </code></pre>
<p>

    Then the thread will run <code class="code">f1 ()</code> to completion, then <code class="code">f2 ()</code> to completion, then
    <code class="code">f3 ()</code> to completion.
<p>

    If <code class="code">name</code> is supplied, the name of the thread will be set to it for the duration of
    the execution of <code class="code">f ()</code>.<br>
</div>

<pre><span id="VALsyscall"><span class="keyword">val</span> syscall</span> : <code class="type">name:string -><br>       (unit -> 'a) -> ('a, exn) Core.Std.Result.t Async_core.Deferred.t</code></pre><div class="info ">
<code class="code">syscall f</code> runs f, which should be a single system call, and returns the result,
    handling the restarting of interrupted system calls.  To avoid race conditions, the
    <code class="code">f</code> supplied to <code class="code">syscall</code> should just make a system call.  That way, everything else
    is done holding the Async lock.<br>
</div>

<pre><span id="VALsyscall_exn"><span class="keyword">val</span> syscall_exn</span> : <code class="type">name:string -> (unit -> 'a) -> 'a Async_core.Deferred.t</code></pre></body></html>