From fb8f3bcd6cec02243098ec60838ce0a7778aff38 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 29 Nov 2018 16:26:48 -0500 Subject: scripting: channel: Add channel-get! and channel-put! procedures. * chickadee/scripting/channel.scm (channel-get!, channel-put!): New procedures. * doc/api.texi [Channels]: Add docs. --- doc/api.texi | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'doc') diff --git a/doc/api.texi b/doc/api.texi index 4c34cf4..c79af20 100644 --- a/doc/api.texi +++ b/doc/api.texi @@ -1934,10 +1934,6 @@ procedure @var{handler}. Wait @var{duration} before resuming the current script. @end deffn -@deffn {Procedure} channel-get @var{channel} -Wait for a message from @var{channel}. -@end deffn - @deffn {Syntax} forever @var{body} @dots{} Evaluate @var{body} in an endless loop. @end deffn @@ -2014,3 +2010,16 @@ until a value is available. Send @var{data} to @var{channel}. The current script suspends until another script is available to retrieve the value. @end deffn + +A low-level API also exists for using channels outside of a script via +callback procedures: + +@deffn {Procedure} channel-get! @var{channel} @var{proc} +Asynchronously retrieve a value from @var{channel} and call @var{proc} +with that value. +@end deffn + +@deffn {Procedure} channel-put! @var{channel} @var{data} [@var{thunk}] +Asynchronously send @var{data} to @var{channel} and call @var{thunk} +after it has been received. +@end deffn -- cgit v1.2.3