From 25c5eac5e6ca1035db1eddd7bea9ac78531da57e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 28 Dec 2023 11:23:49 -0500 Subject: Delete manuals! Good riddance! These are hosted on files.dthompson.us now! --- manuals/chickadee/Channels.html | 157 ---------------------------------------- 1 file changed, 157 deletions(-) delete mode 100644 manuals/chickadee/Channels.html (limited to 'manuals/chickadee/Channels.html') diff --git a/manuals/chickadee/Channels.html b/manuals/chickadee/Channels.html deleted file mode 100644 index 78f8564..0000000 --- a/manuals/chickadee/Channels.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - -Channels (The Chickadee Game Toolkit) - - - - - - - - - - - - - - - - - - - -
-

-Previous: , Up: Scripting   [Contents][Index]

-
-
-

5.5.4 Channels

- -

Channels are a tool for communicating amongst different scripts. One -script can write a value to the channel and another can read from it. -Reading or writing to a channel suspends that script until there is -someone on the other end of the line to complete the transaction. -

-

Here’s a simplistic example: -

-
-
(define c (make-channel))
-
-(script
- (forever
-  (let ((item (channel-get c)))
-    (pk 'got item))))
-
-(script
- (channel-put c 'sword)
- (channel-put c 'shield)
- (channel-put c 'potion))
-
- -
-
Procedure: make-channel
-

Return a new channel -

- -
-
Procedure: channel? obj
-

Return #t if obj is a channel. -

- -
-
Procedure: channel-get channel
-

Retrieve a value from channel. The current script suspends -until a value is available. -

- -
-
Procedure: channel-put channel data
-

Send data to channel. The current script suspends until -another script is available to retrieve the value. -

- -

A low-level API also exists for using channels outside of a script via -callback procedures: -

-
-
Procedure: channel-get! channel proc
-

Asynchronously retrieve a value from channel and call proc -with that value. -

- -
-
Procedure: channel-put! channel data [thunk]
-

Asynchronously send data to channel and call thunk -after it has been received. -

- -
-
Procedure: channel-clear! channel
-

Clear all messages and scripts awaiting messages in channel. -

- - - - - - -- cgit v1.2.3