Concurrent ML-like concurrency for Guile
  • Scheme 66.8%
  • M4 25%
  • C 5.9%
  • Makefile 1.8%
  • Shell 0.5%
Find a file
Chad House c14bbf3853
All checks were successful
GNU Guile 2.2 / build-libevent (push) Successful in 3m40s
GNU Guile 2.2 / build (push) Successful in 3m42s
GNU Guile 3.0 / build (push) Successful in 3m42s
GNU Guile 3.0 / build-libevent (push) Successful in 2m32s
io-wakeup: ‘make-wait-operation’ receives fd instead of port.
If the port associated with a wait operation was closed just prior to
the cancelation of the file descriptor (fd) waiter created by that
operation, an exception would occur while attempting to lookup the
port’s fd again.

* fibers/io-wakeup.scm (readable?): Fix docstring.
  (make-wait-operation): Receive ‘ready-fd’ instead of ‘port’ and
  ‘port-ready-fd’ parameters so the required fd is captured by
  the constructor.
  (make-read-operation, make-write-operation): Resolve the required
  read- or write-wait fd from the specified port and pass to the
  ‘make-wait-operation’ constructor.
* tests/cancel-port-waiters.scm: Add a test for the above scenario.
* NEWS: Update

Fixes: guile/fibers#168
Reported-by: David Thompson <davet@gnu.org>
2026-04-04 18:24:17 +02:00
.forgejo/workflows workflows: Update to new default branch name. 2026-04-04 16:34:33 +02:00
.guix Change URL to https://codeberg.org/guile/fibers. 2025-11-05 20:47:49 +01:00
benchmarks Add local ping-pong benchmark 2017-06-18 18:20:13 +02:00
build-aux build: Really install ‘fibers/config.scm’. 2025-09-27 16:35:00 +02:00
examples updated all LGPL notices 2022-12-12 13:48:04 -08:00
extensions libevent: Fix computation of the timeout value. 2024-01-06 23:05:45 +01:00
fibers io-wakeup: ‘make-wait-operation’ receives fd instead of port. 2026-04-04 18:24:17 +02:00
m4 Sync guile.m4 with guile/meta/guile.m4. 2025-11-10 15:01:46 +01:00
tests io-wakeup: ‘make-wait-operation’ receives fd instead of port. 2026-04-04 18:24:17 +02:00
web/server updated all LGPL notices 2022-12-12 13:48:04 -08:00
.gitignore doc: Include generated ‘version.texi’. 2026-01-07 17:27:59 +01:00
AUTHORS initial commit 2016-07-03 17:24:24 +02:00
autogen.sh initial commit 2016-07-03 17:24:24 +02:00
ChangeLog initial commit 2016-07-03 17:24:24 +02:00
configure.ac Fibers 1.4.2 2025-11-12 12:34:09 +01:00
COPYING Sync COPYING* files from gnulib. 2025-08-23 16:28:56 +02:00
COPYING.LESSER Sync COPYING* files from gnulib. 2025-08-23 16:28:56 +02:00
env.in Simplify env.in 2024-11-23 10:13:17 +00:00
fibers.scm Replace sleep in (fibers) instead of re-exporting to avoid warnings. 2025-10-01 14:38:46 +02:00
fibers.texi doc: Include generated ‘version.texi’. 2026-01-07 17:27:59 +01:00
guix.scm guix: Add a Guile module to define the package. 2024-11-23 10:51:36 +00:00
HACKING initial commit 2016-07-03 17:24:24 +02:00
Makefile.am io-wakeup: On choice operations, unschedule file descriptor waiters. 2025-11-09 21:48:12 +01:00
NEWS io-wakeup: ‘make-wait-operation’ receives fd instead of port. 2026-04-04 18:24:17 +02:00
README Release preparations 2016-09-11 14:33:38 +02:00
README.md README: Fix manual URL. 2026-02-12 22:59:40 +01:00
TODO.md Update TODO 2017-01-08 17:41:30 +01:00

Fibers

Fibers is a facility that provides Go-like concurrency for Guile Scheme, in the tradition of Concurrent ML.

GNU Guile 2.2 GNU Guile 3.0

A pasteable introduction to using Fibers

;; Paste this into your guile interpreter!

(use-modules (fibers) (fibers channels) (ice-9 match))

(define (server in out)
  (let lp ()
    (match (pk 'server-received (get-message in))
      ('ping! (put-message out 'pong!))
      ('sup   (put-message out 'not-much-u))
      (msg    (put-message out (cons 'wat msg))))
    (lp)))

(define (client in out)
  (for-each (lambda (msg)
              (put-message out msg)
              (pk 'client-received (get-message in)))
            '(ping! sup)))

(run-fibers
 (lambda ()
   (let ((c2s (make-channel))
         (s2c (make-channel)))
     (spawn-fiber (lambda () (server c2s s2c)))
     (client s2c c2s))))

If you paste the above at into a Guile REPL, it prints out:

;;; (server-received ping!)

;;; (client-received pong!)

;;; (server-received sup)

;;; (client-received not-much-u)

Contact info

Mailing List: guile-user@gnu.org

Homepage: https://codeberg.org/guile/fibers

Download: https://codeberg.org/guile/fibers/releases

Manual: https://doc.guix.gnu.org/fibers/latest/en/html_node/

Build dependencies

Guile 3.0.x or 2.2.x (https://www.gnu.org/software/guile/).

If you build from source you also need autoconf, automake and libtool.

Installation quickstart

Install from a release tarball using the standard autotools incantation:

./configure --prefix=/opt/guile && make && make install

Build from Git is the same, except run autoreconf -vif first.

You can run without installing, just run ./env guile.

Copying Fibers

Distribution of Fibers is under the LGPLv3+. See the COPYING and COPYING.LESSER files for more information.

Copying this file

Copyright (C) 2016 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.