summaryrefslogtreecommitdiff
path: root/chickadee/scripting
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-04-28 21:09:53 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-04-28 21:09:53 -0400
commit47fec2398a192c23424825d7ec7aacc92b6f015d (patch)
tree364fd6d21cd7711a978357de74c0db9df1782add /chickadee/scripting
parent5455bb27b00108920a566bdfb4eea21b2d7e4569 (diff)
scripting: channel: Add channel-clear! procedure.
Diffstat (limited to 'chickadee/scripting')
-rw-r--r--chickadee/scripting/channel.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/chickadee/scripting/channel.scm b/chickadee/scripting/channel.scm
index edb782e..6df1313 100644
--- a/chickadee/scripting/channel.scm
+++ b/chickadee/scripting/channel.scm
@@ -84,3 +84,8 @@ script is available to retrieve the value."
(yield
(lambda (cont)
(channel-put! channel data cont))))
+
+(define (channel-clear! channel)
+ "Clear all messages and scripts awaiting messages in CHANNEL."
+ (queue-clear! (channel-get-queue channel))
+ (queue-clear! (channel-put-queue channel)))