mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
futures: Add a record printer.
* module/ice-9/futures.scm: Add a record printer for <future>.
This commit is contained in:
parent
f2fb5e5328
commit
ab975cf592
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
||||||
(define-module (ice-9 futures)
|
(define-module (ice-9 futures)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-9)
|
#:use-module (srfi srfi-9)
|
||||||
|
#:use-module (srfi srfi-9 gnu)
|
||||||
#:use-module (ice-9 threads)
|
#:use-module (ice-9 threads)
|
||||||
#:use-module (ice-9 q)
|
#:use-module (ice-9 q)
|
||||||
#:export (future make-future future? touch))
|
#:export (future make-future future? touch))
|
||||||
|
@ -52,6 +53,14 @@
|
||||||
(mutex future-mutex)
|
(mutex future-mutex)
|
||||||
(completion future-completion)) ; completion cond. var.
|
(completion future-completion)) ; completion cond. var.
|
||||||
|
|
||||||
|
(set-record-type-printer!
|
||||||
|
<future>
|
||||||
|
(lambda (future port)
|
||||||
|
(simple-format port "#<future ~a ~a ~s>"
|
||||||
|
(number->string (object-address future) 16)
|
||||||
|
(future-state future)
|
||||||
|
(future-thunk future))))
|
||||||
|
|
||||||
(define (make-future thunk)
|
(define (make-future thunk)
|
||||||
"Return a new future for THUNK. Execution may start at any point
|
"Return a new future for THUNK. Execution may start at any point
|
||||||
concurrently, or it can start at the time when the returned future is
|
concurrently, or it can start at the time when the returned future is
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue