From f16fed3d50fd3d56deb46a3d4641a81460e389de Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 12 Dec 2018 09:20:10 -0500 Subject: Update Chickadee manual and home page for 0.3.0. Better late than never! --- manuals/chickadee/Channels.html | 146 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 manuals/chickadee/Channels.html (limited to 'manuals/chickadee/Channels.html') diff --git a/manuals/chickadee/Channels.html b/manuals/chickadee/Channels.html new file mode 100644 index 0000000..f313c4f --- /dev/null +++ b/manuals/chickadee/Channels.html @@ -0,0 +1,146 @@ + + + + + + +Channels (The Chickadee Game Toolkit) + + + + + + + + + + + + + + + + + + + + +
+

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

+
+
+ +

2.4.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. +

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