Automatic website update

This commit is contained in:
Automatic website updater 2026-03-18 09:43:30 +00:00
parent 3ddbf2d8c5
commit 598b1739f0

View file

@ -180,7 +180,11 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-call_002dwith_002ddefault_002dio_002dwaiters"><span class="category-def">Procedure: </span><span><strong class="def-name">call-with-default-io-waiters</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-call_002dwith_002ddefault_002dio_002dwaiters"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Run THUNK with Guile&rsquo;s default blocking I/O waiters active.
</p>
<p>This is useful when restoring the default Guile I/O waiters from within
a context (like Fibers) where different I/O waiters are used, for
example when creating a new thread from a fiber.
</p>
</dd></dl>
@ -189,8 +193,19 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-call_002dwith_002dsigint"><span class="category-def">Procedure: </span><span><strong class="def-name">call-with-sigint</strong> <var class="def-var-arguments">a b</var><a class="copiable-link" href="#index-call_002dwith_002dsigint"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Run THUNK with a SIGINT handler that signals the Fibers condition CVAR.
Restores the previous handler when THUNK returns.
</p>
<p>Typical usage is to pass a condition variable to this procedure and wait
on CVAR in a fiber to implement clean shutdown on Ctrl-C:
</p>
<div class="example">
<pre class="example-preformatted">(let ((quit-cvar (make-condition)))
(call-with-sigint
(lambda () (wait quit-cvar))
quit-cvar))
</pre></div>
</dd></dl>
@ -198,7 +213,11 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-display_002fknots"><span class="category-def">Procedure: </span><span><strong class="def-name">display/knots</strong> <var class="def-var-arguments">_ OPT: _</var><a class="copiable-link" href="#index-display_002fknots"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Write OBJ to PORT (default: current output port) as a UTF-8 byte
sequence via <code class="code">put-bytevector</code>.
</p>
<p>When used with ports without buffering, this should be safer than
display.
</p>
</dd></dl>
@ -207,7 +226,8 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-format_002fknots"><span class="category-def">Procedure: </span><span><strong class="def-name">format/knots</strong> <var class="def-var-arguments">a b . rest</var><a class="copiable-link" href="#index-format_002fknots"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Like <code class="code">format</code> but should be safer when used with a port without
buffering.
</p>
</dd></dl>
@ -252,7 +272,8 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-simple_002dformat_002fknots"><span class="category-def">Procedure: </span><span><strong class="def-name">simple-format/knots</strong> <var class="def-var-arguments">a b . rest</var><a class="copiable-link" href="#index-simple_002dformat_002fknots"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Like <code class="code">simple-format</code> but should be safer when used with a port
without buffering.
</p>
</dd></dl>
@ -261,7 +282,10 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-spawn_002dfiber_002fknots"><span class="category-def">Procedure: </span><span><strong class="def-name">spawn-fiber/knots</strong> <var class="def-var-arguments">_ OPT: _ KEY: #:parallel?</var><a class="copiable-link" href="#index-spawn_002dfiber_002fknots"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Spawn a fiber to run THUNK, with knots exception handling.
</p>
<p>Accepts the same optional SCHEDULER and <code class="code">#:parallel?</code> arguments as
<code class="code">spawn-fiber</code>.
</p>
</dd></dl>
@ -270,7 +294,11 @@ Next: <a href="#knots_005fnon_002dblocking" accesskey="n" rel="next">(knots non-
<dl class="first-deffn">
<dt class="deffn" id="index-wait_002dwhen_002dsystem_002dclock_002dbehind"><span class="category-def">Procedure: </span><span><strong class="def-name">wait-when-system-clock-behind</strong><a class="copiable-link" href="#index-wait_002dwhen_002dsystem_002dclock_002dbehind"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Block until the system clock reads at least 2001-01-02.
</p>
<p>Useful at startup in environments (virtual machines, embedded systems)
where the clock may start at or near the Unix epoch. Prints a warning
to the current error port every 20 seconds while waiting.
</p>
</dd></dl>
@ -320,7 +348,16 @@ Next: <a href="#knots_005fparallelism" accesskey="n" rel="next">(knots paralleli
<dl class="first-deffn">
<dt class="deffn" id="index-non_002dblocking_002dopen_002dsocket_002dfor_002duri"><span class="category-def">Procedure: </span><span><strong class="def-name">non-blocking-open-socket-for-uri</strong> <var class="def-var-arguments">_ KEY: #:verify-certificate?</var><a class="copiable-link" href="#index-non_002dblocking_002dopen_002dsocket_002dfor_002duri"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Open a socket for URI and return it as a non-blocking port.
</p>
<p>For HTTPS URIs the TLS handshake is completed while the socket is still
blocking (required because Guile&rsquo;s TLS wrapper does not support
non-blocking handshakes), then the underlying socket is made
non-blocking. For plain HTTP the socket is made non-blocking
immediately.
</p>
<p><code class="code">#:verify-certificate?</code> controls TLS certificate verification and
defaults to <code class="code">#t</code>.
</p>
</dd></dl>
@ -405,7 +442,9 @@ this will be raised after all exceptions have finished.
<dl class="first-deffn">
<dt class="deffn" id="index-call_002dwith_002dparallelism_002dlimiter"><span class="category-def">Procedure: </span><span><strong class="def-name">call-with-parallelism-limiter</strong> <var class="def-var-arguments">a b</var><a class="copiable-link" href="#index-call_002dwith_002dparallelism_002dlimiter"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Acquire a slot from PARALLELISM-LIMITER, call THUNK, release the slot,
and return the values from THUNK. Blocks if no slot is currently
available.
</p>
</dd></dl>
@ -423,7 +462,15 @@ this will be raised after all exceptions have finished.
<dl class="first-deffn">
<dt class="deffn" id="index-fiberize"><span class="category-def">Procedure: </span><span><strong class="def-name">fiberize</strong> <var class="def-var-arguments">_ KEY: #:parallelism #:input-channel #:process-channel</var><a class="copiable-link" href="#index-fiberize"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Convert PROC into a procedure backed by <code class="code">#:parallelism</code> (default:
1) background fibers. Returns a wrapper that sends its arguments to one
of the fibers and blocks until the result is returned.
</p>
<p><code class="code">#:input-channel</code> is the channel that callers write requests to;
defaults to a fresh channel. <code class="code">#:process-channel</code> is the channel
the fibers read from; defaults to <code class="code">#:input-channel</code>. Setting them
differently allows external parties to bypass the wrapper and write
directly to <code class="code">process-channel</code>.
</p>
</dd></dl>
@ -483,7 +530,12 @@ LISTS, or #f if no result has been received yet.
<dl class="first-deffn">
<dt class="deffn" id="index-make_002dparallelism_002dlimiter"><span class="category-def">Procedure: </span><span><strong class="def-name">make-parallelism-limiter</strong> <var class="def-var-arguments">_ KEY: #:name</var><a class="copiable-link" href="#index-make_002dparallelism_002dlimiter"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Return a parallelism limiter that allows at most LIMIT concurrent fibers
to execute within <code class="code">with-parallelism-limiter</code> at the same time.
Further fibers block until a slot becomes free.
</p>
<p><code class="code">#:name</code> is a string used in log messages. Defaults to
<code class="code">&quot;unnamed&quot;</code>.
</p>
</dd></dl>
@ -531,7 +583,9 @@ Next: <a href="#knots_005fqueue" accesskey="n" rel="next">(knots queue)</a>, Pre
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002ddelay"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-delay</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-fibers_002ddelay"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Return a new fiber-aware promise that will evaluate THUNK when first
forced. THUNK is not called until <code class="code">fibers-force</code> is called on the
promise.
</p>
</dd></dl>
@ -540,7 +594,9 @@ Next: <a href="#knots_005fqueue" accesskey="n" rel="next">(knots queue)</a>, Pre
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002ddelay_002feager"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-delay/eager</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-fibers_002ddelay_002feager"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Return a new fiber-aware promise and immediately begin evaluating THUNK
in a new fiber. Exceptions during eager evaluation are silently
discarded; they will be re-raised when <code class="code">fibers-force</code> is called.
</p>
</dd></dl>
@ -549,7 +605,12 @@ Next: <a href="#knots_005fqueue" accesskey="n" rel="next">(knots queue)</a>, Pre
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002dforce"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-force</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-fibers_002dforce"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Force the fiber-aware promise FP, returning its values.
</p>
<p>The first call evaluates the promise&rsquo;s thunk. Concurrent callers block
on a condition variable until evaluation finishes, then receive the same
result. If the thunk raises an exception, the exception is stored and
re-raised for all callers.
</p>
</dd></dl>
@ -558,7 +619,8 @@ Next: <a href="#knots_005fqueue" accesskey="n" rel="next">(knots queue)</a>, Pre
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002dpromise_002dreset"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-promise-reset</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-fibers_002dpromise_002dreset"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Reset the fiber-aware promise FP so that the next call to
<code class="code">fibers-force</code> re-evaluates its thunk.
</p>
</dd></dl>
@ -567,7 +629,9 @@ Next: <a href="#knots_005fqueue" accesskey="n" rel="next">(knots queue)</a>, Pre
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002dpromise_002dresult_002davailable_003f"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-promise-result-available?</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-fibers_002dpromise_002dresult_002davailable_003f"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Return <code class="code">#t</code> if the fiber-aware promise FP has been evaluated
(successfully or with an exception) and <code class="code">#f</code> if evaluation has not
yet started or is still in progress.
</p>
</dd></dl>
@ -599,7 +663,12 @@ Next: <a href="#knots_005fresource_002dpool" accesskey="n" rel="next">(knots res
<dl class="first-deffn">
<dt class="deffn" id="index-spawn_002dqueueing_002dfiber"><span class="category-def">Procedure: </span><span><strong class="def-name">spawn-queueing-fiber</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-spawn_002dqueueing_002dfiber"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Spawn a fiber that serialises items onto DEST-CHANNEL in FIFO order.
Returns a new input channel.
</p>
<p>Multiple producers can put items on the returned channel concurrently.
The fiber buffers them locally and forwards them to DEST-CHANNEL one at
a time, preserving arrival order.
</p>
</dd></dl>
@ -712,7 +781,10 @@ available. Return the resource once PROC has returned.
<dl class="first-deffn">
<dt class="deffn" id="index-destroy_002dresource_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">destroy-resource-pool</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-destroy_002dresource_002dpool"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Destroy POOL, preventing any new checkouts. Blocks until all
checked-out resources have been returned, running the pool&rsquo;s
<code class="code">#:destructor</code> on each. Any fibers waiting for a resource receive
<code class="code">&amp;resource-pool-destroyed</code>.
</p>
</dd></dl>
@ -721,8 +793,38 @@ available. Return the resource once PROC has returned.
<dl class="first-deffn">
<dt class="deffn" id="index-make_002dfixed_002dsize_002dresource_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">make-fixed-size-resource-pool</strong> <var class="def-var-arguments">_ KEY: #:delay-logger #:duration-logger #:scheduler #:name #:default-checkout-timeout #:default-max-waiters</var><a class="copiable-link" href="#index-make_002dfixed_002dsize_002dresource_002dpool"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Create a resource pool from RESOURCES-LIST-OR-VECTOR, a list or vector
of pre-existing resource values.
</p>
<p>Use <code class="code">with-resource-from-pool</code> or
<code class="code">call-with-resource-from-pool</code> to borrow a resource and return it
automatically when done.
</p>
<p>Optional keyword arguments:
</p>
<dl class="table">
<dt><code class="code">#:name</code></dt>
<dd><p>A optional string used in log messages. Defaults to <code class="code">&quot;unnamed&quot;</code>.
</p>
</dd>
<dt><code class="code">#:default-checkout-timeout</code></dt>
<dd><p>Default checkout timeout when requesting a resource from the pool, unset
by default.
</p>
</dd>
<dt><code class="code">#:default-max-waiters</code></dt>
<dd><p>Maximum number of fibers that may queue waiting for a resource. When
this limit is exceeded, <code class="code">&amp;resource-pool-too-many-waiters</code> is raised
when a resource is requested. Defaults to <code class="code">#f</code> (no limit).
</p>
</dd>
<dt><code class="code">#:scheduler</code></dt>
<dd><p>The Fibers scheduler to use for the pool&rsquo;s internal fiber. Defaults to
the current scheduler.
</p>
</dd>
</dl>
</dd></dl>
@ -730,8 +832,69 @@ available. Return the resource once PROC has returned.
<dl class="first-deffn">
<dt class="deffn" id="index-make_002dresource_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">make-resource-pool</strong> <var class="def-var-arguments">_ _ KEY: #:min-size #:idle-seconds #:delay-logger #:duration-logger #:destructor #:lifetime #:scheduler #:name #:add-resources-parallelism #:default-checkout-timeout #:default-max-waiters</var><a class="copiable-link" href="#index-make_002dresource_002dpool"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Create a dynamic resource pool. RETURN-NEW-RESOURCE is a thunk called
to create each new resource value. MAX-SIZE is the maximum number of
resources the pool will hold simultaneously.
</p>
<p>Resources are created on demand when a checkout is requested and the
pool is not yet at MAX-SIZE. Use <code class="code">with-resource-from-pool</code> or
<code class="code">call-with-resource-from-pool</code> to request a resource and return it
automatically when done.
</p>
<p>Optional keyword arguments:
</p>
<dl class="table">
<dt><code class="code">#:min-size</code></dt>
<dd><p>Minimum number of resources to keep alive even when idle. Defaults to
<code class="code">0</code>.
</p>
</dd>
<dt><code class="code">#:idle-seconds</code></dt>
<dd><p>Seconds a resource may remain unused before being destroyed, provided
the pool is above <code class="code">#:min-size</code>. Defaults to <code class="code">#f</code> (never
expire idle resources).
</p>
</dd>
<dt><code class="code">#:lifetime</code></dt>
<dd><p>Maximum number of checkouts a single resource will serve before being
destroyed and replaced by a fresh one. Defaults to <code class="code">#f</code> (no
limit).
</p>
</dd>
<dt><code class="code">#:destructor</code></dt>
<dd><p>A procedure called as <code class="code">(destructor resource)</code> when a resource is
removed from the pool. Defaults to <code class="code">#f</code>.
</p>
</dd>
<dt><code class="code">#:add-resources-parallelism</code></dt>
<dd><p>Maximum number of concurrent calls to RETURN-NEW-RESOURCE when the pool
needs to grow. Allowing resources to be created in parallel can result
in more resources being created than can fit inside the pool, if this
happens, the surplus resources are destroyed. Defaults to <code class="code">1</code>.
</p>
</dd>
<dt><code class="code">#:name</code></dt>
<dd><p>A string used in log messages. Defaults to <code class="code">&quot;unnamed&quot;</code>.
</p>
</dd>
<dt><code class="code">#:default-checkout-timeout</code></dt>
<dd><p>Default checkout timeout when requesting a resource from the pool, unset
by default.
</p>
</dd>
<dt><code class="code">#:default-max-waiters</code></dt>
<dd><p>Maximum number of fibers that may queue waiting for a resource. When
this limit is exceeded, <code class="code">&amp;resource-pool-too-many-waiters</code> is raised
when a resource is requested. Defaults to <code class="code">#f</code> (no limit).
</p>
</dd>
<dt><code class="code">#:scheduler</code></dt>
<dd><p>The Fibers scheduler to use for the pool&rsquo;s internal fiber. Defaults to
the current scheduler.
</p>
</dd>
</dl>
</dd></dl>
@ -775,7 +938,31 @@ available. Return the resource once PROC has returned.
<dl class="first-deffn">
<dt class="deffn" id="index-resource_002dpool_002dstats"><span class="category-def">Procedure: </span><span><strong class="def-name">resource-pool-stats</strong> <var class="def-var-arguments">_ KEY: #:timeout</var><a class="copiable-link" href="#index-resource_002dpool_002dstats"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Return an alist of statistics for POOL with the following keys:
</p>
<dl class="table">
<dt><code class="code">resources</code></dt>
<dd><p>Total number of resources currently held by the pool.
</p>
</dd>
<dt><code class="code">available</code></dt>
<dd><p>Number of resources not currently checked out.
</p>
</dd>
<dt><code class="code">waiters</code></dt>
<dd><p>Number of fibers currently queued waiting for a resource.
</p>
</dd>
<dt><code class="code">checkout-failure-count</code></dt>
<dd><p>Cumulative number of checkouts where an exception was raised inside the
proc.
</p>
</dd>
</dl>
<p>Blocks waiting for the pool fiber to respond. <code class="code">#:timeout</code> is the
number of seconds to wait; defaults to <code class="code">5</code>. Raises
<code class="code">&amp;resource-pool-timeout</code> if the pool does not respond in time.
</p>
</dd></dl>
@ -906,7 +1093,15 @@ Next: <a href="#knots_005fthread_002dpool" accesskey="n" rel="next">(knots threa
<dl class="first-deffn">
<dt class="deffn" id="index-fibers_002dsort_0021"><span class="category-def">Procedure: </span><span><strong class="def-name">fibers-sort!</strong> <var class="def-var-arguments">_ _ KEY: #:parallelism</var><a class="copiable-link" href="#index-fibers_002dsort_0021"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Sort ITEMS destructively using LESS as the comparison procedure, using a
parallel merge sort. Returns the sorted list.
</p>
<p>Splits ITEMS into chunks, sorts each in an eager fiber-promise in
parallel, then merges pairs of sorted chunks in parallel until one
sorted list remains.
</p>
<p><code class="code">#:parallelism</code> sets the number of initial chunks. Defaults to the
current fibers parallelism.
</p>
</dd></dl>
@ -991,9 +1186,41 @@ Next: <a href="#knots_005ftimeout" accesskey="n" rel="next">(knots timeout)</a>,
<dl class="first-deffn">
<dt class="deffn" id="index-call_002dwith_002dthread"><span class="category-def">Procedure: </span><span><strong class="def-name">call-with-thread</strong> <var class="def-var-arguments">_ _ KEY: #:duration-logger #:checkout-timeout #:channel #:destroy-thread-on-exception? #:max-waiters</var><a class="copiable-link" href="#index-call_002dwith_002dthread"> &para;</a></span></dt>
<dd><p>Send PROC to the thread pool through CHANNEL. Return the result of
PROC. If already in the thread pool, call PROC immediately.
<dd><p>Run PROC in THREAD-POOL and return its values, blocking until complete.
If called from within a thread that already belongs to THREAD-POOL, PROC
is called directly in that thread.
</p>
<p>Optional keyword arguments:
</p>
<dl class="table">
<dt><code class="code">#:checkout-timeout</code></dt>
<dd><p>Seconds to wait for a free thread before raising
<code class="code">&amp;thread-pool-timeout-error</code>. Defaults to the pool&rsquo;s
<code class="code">#:default-checkout-timeout</code>.
</p>
</dd>
<dt><code class="code">#:max-waiters</code></dt>
<dd><p>Maximum number of fibers that may queue waiting for a thread (for
dynamic pools). Defaults to the pool&rsquo;s <code class="code">#:default-max-waiters</code>.
</p>
</dd>
<dt><code class="code">#:destroy-thread-on-exception?</code></dt>
<dd><p>When <code class="code">#t</code>, destroy the thread after PROC raises an exception.
Equivalent to per-call <code class="code">#:expire-on-exception?</code>. Defaults to
<code class="code">#f</code>.
</p>
</dd>
<dt><code class="code">#:duration-logger</code></dt>
<dd><p>Called as <code class="code">(duration-logger seconds)</code> after PROC completes (whether
or not it raised an exception).
</p>
</dd>
<dt><code class="code">#:channel</code></dt>
<dd><p>Override the channel used to communicate with the thread.
</p>
</dd>
</dl>
</dd></dl>
@ -1001,7 +1228,8 @@ PROC. If already in the thread pool, call PROC immediately.
<dl class="first-deffn">
<dt class="deffn" id="index-destroy_002dthread_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">destroy-thread-pool</strong> <var class="def-var-arguments">a</var><a class="copiable-link" href="#index-destroy_002dthread_002dpool"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Destroy POOL, stopping all of its threads and calling the destructor if
specified. This procedure will block until the destruction is complete.
</p>
</dd></dl>
@ -1010,8 +1238,63 @@ PROC. If already in the thread pool, call PROC immediately.
<dl class="first-deffn">
<dt class="deffn" id="index-make_002dfixed_002dsize_002dthread_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">make-fixed-size-thread-pool</strong> <var class="def-var-arguments">_ KEY: #:thread-initializer #:thread-destructor #:delay-logger #:duration-logger #:thread-lifetime #:expire-on-exception? #:name #:use-default-io-waiters? #:default-checkout-timeout</var><a class="copiable-link" href="#index-make_002dfixed_002dsize_002dthread_002dpool"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Create a pool of SIZE threads started immediately. Use
<code class="code">call-with-thread</code> to run a procedure in one of the threads.
</p>
<p>Optional keyword arguments:
</p>
<dl class="table">
<dt><code class="code">#:thread-initializer</code></dt>
<dd><p>A thunk called once when each thread starts. Its return value is passed
as extra arguments to every procedure run in that thread. Defaults to
<code class="code">#f</code> (no extra arguments).
</p>
</dd>
<dt><code class="code">#:thread-destructor</code></dt>
<dd><p>A procedure called with the value returned by
<code class="code">#:thread-initializer</code> when a thread exits. Defaults to <code class="code">#f</code>.
</p>
</dd>
<dt><code class="code">#:thread-lifetime</code></dt>
<dd><p>Maximum number of procedures a thread will run before restarting (and
re-running <code class="code">#:thread-initializer</code>). Defaults to <code class="code">#f</code> (no
limit).
</p>
</dd>
<dt><code class="code">#:expire-on-exception?</code></dt>
<dd><p>When <code class="code">#t</code>, replace a thread after any unhandled exception. Defaults
to <code class="code">#f</code>.
</p>
</dd>
<dt><code class="code">#:use-default-io-waiters?</code></dt>
<dd><p>When <code class="code">#t</code> (the default), each thread uses blocking I/O waiters so
that port reads and writes block the thread rather than trying to
suspend a fiber.
</p>
</dd>
<dt><code class="code">#:name</code></dt>
<dd><p>String used in thread names and log messages. Defaults to
<code class="code">&quot;unnamed&quot;</code>.
</p>
</dd>
<dt><code class="code">#:default-checkout-timeout</code></dt>
<dd><p>Seconds to wait for a free thread slot before raising
<code class="code">&amp;thread-pool-timeout-error</code>. Defaults to <code class="code">#f</code> (wait
forever).
</p>
</dd>
<dt><code class="code">#:delay-logger</code></dt>
<dd><p>Called as <code class="code">(delay-logger seconds proc)</code> with the time spent waiting
for a thread to become available.
</p>
</dd>
<dt><code class="code">#:duration-logger</code></dt>
<dd><p>Called as <code class="code">(duration-logger seconds proc)</code> after each procedure
completes.
</p>
</dd>
</dl>
</dd></dl>
@ -1019,9 +1302,39 @@ PROC. If already in the thread pool, call PROC immediately.
<dl class="first-deffn">
<dt class="deffn" id="index-make_002dthread_002dpool"><span class="category-def">Procedure: </span><span><strong class="def-name">make-thread-pool</strong> <var class="def-var-arguments">_ KEY: #:min-size #:scheduler #:thread-initializer #:thread-destructor #:delay-logger #:duration-logger #:thread-lifetime #:expire-on-exception? #:name #:use-default-io-waiters? #:default-checkout-timeout #:default-max-waiters</var><a class="copiable-link" href="#index-make_002dthread_002dpool"> &para;</a></span></dt>
<dd><p>Return a channel used to offload work to a dedicated thread. ARGS are
the arguments of the thread pool procedure.
<dd><p>Create a dynamic thread pool with up to MAX-SIZE threads. Use
<code class="code">call-with-thread</code> to run a procedure in one of the threads.
</p>
<p>Unlike <code class="code">make-fixed-size-thread-pool</code>, threads are created on demand
and may be reclaimed when idle (controlled by <code class="code">#:min-size</code> and the
resource pool&rsquo;s idle management).
</p>
<p>Accepts the same <code class="code">#:thread-initializer</code>,
<code class="code">#:thread-destructor</code>, <code class="code">#:thread-lifetime</code>,
<code class="code">#:expire-on-exception?</code>, <code class="code">#:use-default-io-waiters?</code>,
<code class="code">#:name</code>, <code class="code">#:default-checkout-timeout</code>, <code class="code">#:delay-logger</code>,
and <code class="code">#:duration-logger</code> arguments as
<code class="code">make-fixed-size-thread-pool</code>, plus:
</p>
<dl class="table">
<dt><code class="code">#:min-size</code></dt>
<dd><p>Minimum number of threads to keep alive. Defaults to MAX-SIZE (i.e.:
the pool is pre-filled and never shrinks).
</p>
</dd>
<dt><code class="code">#:scheduler</code></dt>
<dd><p>Fibers scheduler for the pool&rsquo;s internal resource pool fiber. Defaults
to the current scheduler.
</p>
</dd>
<dt><code class="code">#:default-max-waiters</code></dt>
<dd><p>Maximum number of fibers that may queue waiting for a thread. Raises
<code class="code">&amp;thread-pool-timeout-error</code> when exceeded. Defaults to <code class="code">#f</code>
(no limit).
</p>
</dd>
</dl>
</dd></dl>
@ -1171,7 +1484,12 @@ Next: <a href="#knots_005fweb_002dserver" accesskey="n" rel="next">(knots web-se
<dl class="first-deffn">
<dt class="deffn" id="index-with_002dfibers_002dtimeout"><span class="category-def">Procedure: </span><span><strong class="def-name">with-fibers-timeout</strong> <var class="def-var-arguments">_ KEY: #:timeout #:on-timeout</var><a class="copiable-link" href="#index-with_002dfibers_002dtimeout"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Run THUNK in a new fiber and return its values, waiting TIMEOUT seconds
for it to finish. If THUNK does not complete within TIMEOUT seconds,
the ON-TIMEOUT procedure is called and with-fibers-timeout returns the
result of ON-TIMEOUT instead.
</p>
<p>If THUNK raises an exception it is re-raised in the calling fiber.
</p>
</dd></dl>
@ -1180,7 +1498,21 @@ Next: <a href="#knots_005fweb_002dserver" accesskey="n" rel="next">(knots web-se
<dl class="first-deffn">
<dt class="deffn" id="index-with_002dport_002dtimeouts"><span class="category-def">Procedure: </span><span><strong class="def-name">with-port-timeouts</strong> <var class="def-var-arguments">_ KEY: #:timeout #:read-timeout #:write-timeout</var><a class="copiable-link" href="#index-with_002dport_002dtimeouts"> &para;</a></span></dt>
<dd><p>Undocumented procedure.
<dd><p>Run THUNK with per-operation I/O timeouts on all ports. If any read or
write blocks for longer than the given number of seconds, an exception
is raised.
</p>
<p><code class="code">#:timeout</code> sets both read and write timeouts.
<code class="code">#:read-timeout</code> and <code class="code">#:write-timeout</code> specify the timeout for
reads and writes respectively. All three default to <code class="code">#f</code> (no
timeout).
</p>
<p>This procedure works both with fibers, and without fibers by using the
poll system call with a timeout.
</p>
<p>On read timeout, raises <code class="code">&amp;port-read-timeout-error</code>. On write
timeout, raises <code class="code">&amp;port-write-timeout-error</code>. Both carry the
<code class="code">thunk</code> and <code class="code">port</code> fields from <code class="code">&amp;port-timeout-error</code>.
</p>
</dd></dl>