Guile Knots is a library providing tools and patterns for programming with Guile Fibers. Guile Knots provides higher level building blocks for writing programs using Guile Fibers, including managing code that can’t run in a thread used by fibers. Also included is a web server implementation using Fibers, which while being similar to the web server provided by Fibers, can provide some benefits in specific circumstances.
The following is the list of modules provided by this library.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Let, but run each binding in a fiber in parallel.
Run each expression in parallel. If any expression raises an exception, this will be raised after all exceptions have finished.
Undocumented macro.
Undocumented macro.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Call PROC on LISTS, running up to PARALLELISM-LIMIT fibers in parallel.
Map PROC over LISTS in parallel, with a PARALLELISM-LIMIT. If any of the invocations of PROC raise an exception, this will be raised once all of the calls to PROC have finished.
Call PROC on LISTS, running up to 20 fibers in parallel.
Map PROC over LISTS in parallel, running up to 20 fibers in PARALLEL. If any of the invocations of PROC raise an exception, this will be raised once all of the calls to PROC have finished.
Map PROC over LISTS, calling #:REPORT if specified after each invocation of PROC finishes. REPORT is passed the results for each element of LISTS, or #f if no result has been received yet.
Undocumented procedure.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Call PROC with a resource from POOL, blocking until a resource becomes available. Return the resource once PROC has returned.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
This record type has the following fields:
This record type has the following fields:
pool
This record type has the following fields:
pool
This record type has the following fields:
pool
waiters-count
Undocumented macro.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Send PROC to the thread pool through CHANNEL. Return the result of PROC. If already in the thread pool, call PROC immediately.
Undocumented procedure.
Undocumented procedure.
Return a channel used to offload work to a dedicated thread. ARGS are the arguments of the thread pool procedure.
Set the name of the calling thread to NAME. NAME is truncated to 15 bytes.
Return the name of the calling thread as a string.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Make an operation that will succeed when PORT is readable.
Make an operation that will succeed when PORT is writable.
Undocumented procedure.
Undocumented procedure.
Undocumented macro.
Undocumented macro.
Undocumented macro.
Undocumented procedure.
Returns a new port which translates non-encoded data into a HTTP chunked transfer encoded data and writes this to PORT. Data written to this port is buffered until the port is flushed, at which point it is all sent as one chunk. The port will otherwise be flushed every BUFFERING bytes, which defaults to 1200. Take care to close the port when done, as it will output the remaining data, and encode the final zero chunk. When the port is closed it will also close PORT, unless KEEP-ALIVE? is true.
Undocumented procedure.
Undocumented procedure.
Undocumented procedure.
Run the knots web server.
HANDLER should be a procedure that takes one argument, the HTTP request and returns two values, the response and response body.
For example, here is a simple "Hello, World!" server:
(define (handler request) (let ((body (read-request-body request))) (values '((content-type . (text/plain))) "Hello, World!"))) (run-knots-web-server handler)
The response and body will be run through ‘sanitize-response’ before sending back to the client.
"Sanitize" the given response and body, making them appropriate for the given request.
As a convenience to web handler authors, RESPONSE may be given as an alist of headers, in which case it is used to construct a default response. Ensures that the response version corresponds to the request version. If BODY is a string, encodes the string to a bytevector, in an encoding appropriate for RESPONSE. Adds a ‘content-length’ and ‘content-type’ header, as necessary.
If BODY is a procedure, it is called with a port as an argument, and the output collected as a bytevector. In the future we might try to instead use a compressing, chunk-encoded port, and call this procedure later, in the write-client procedure. Authors are advised not to rely on the procedure being called at any particular time.
Copyright © 2024, 2025 Christopher Baines <mail@cbaines.net>
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Jump to: | C D F K M N P R S T W |
---|
Jump to: | C D F K M N P R S T W |
---|
Index Entry | Section | |
---|---|---|
R | ||
resource-pool-default-timeout-handler | knots_resource-pool | |