unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile and coroutines controlled from C
@ 2012-07-28 17:29 Vincent Bernat
  2012-07-30  4:56 ` Ian Price
  0 siblings, 1 reply; 7+ messages in thread
From: Vincent Bernat @ 2012-07-28 17:29 UTC (permalink / raw)
  To: guile-user

Hi!

I would like to add Guile scripting to an actual program to allow a user
to write simple network-related scenarios. Those scenarios will be run
in parallel on several entities. The application is event-driven and I
want to hide this fact to the user. She should be able to write a
scenario in a simple blocking style:

#v+
(let ((v1 (do-something-blocking "arg1" "arg2"))
      (v2 (do-something-blocking "arg3" "arg4")))
 (when (< (+ v1 v2) 10) (...)))
#v-

`do-something-blocking` is a registered function written in C. I want to
be able to pause the execution inside this function and then resume it
later (when I my program got the data wanted by the user). In the
meantime, another "cooperative thread" may be executed.

In Lua, this is something that can be done with coroutines which can be
yield and resumed from C. In Guile, there are continuations but I have
hard time to understand how this should work from C.

What would be the equivalent of this in Guile?
 http://kristianrumberg.wordpress.com/2010/11/21/135/
-- 
 /*
  * We used to try various strange things. Let's not.
  */
	2.2.16 /usr/src/linux/fs/buffer.c



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-08-02 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-28 17:29 guile and coroutines controlled from C Vincent Bernat
2012-07-30  4:56 ` Ian Price
2012-07-30  5:38   ` Thien-Thi Nguyen
2012-08-01 13:15     ` Ian Price
2012-07-30  6:28   ` Vincent Bernat
2012-08-01 13:13     ` Ian Price
2012-08-02 17:28       ` Vincent Bernat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).