summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/scripting/channel.scm5
-rw-r--r--doc/api.texi4
2 files changed, 9 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)))
diff --git a/doc/api.texi b/doc/api.texi
index 1d69f3d..da05e62 100644
--- a/doc/api.texi
+++ b/doc/api.texi
@@ -4512,3 +4512,7 @@ with that value.
Asynchronously send @var{data} to @var{channel} and call @var{thunk}
after it has been received.
@end deffn
+
+@deffn {Procedure} channel-clear! channel
+Clear all messages and scripts awaiting messages in @var{channel}.
+@end deffn