guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Potluck - thread safe event loop with await semantics


From: Chris Vine
Subject: Potluck - thread safe event loop with await semantics
Date: Tue, 16 Feb 2016 21:45:12 +0000

Hi,

Here for potluck is a considerably improved version of the event loop on
which I responded a few months ago, which I have spent some time
tidying up this week.

It features an a-sync procedure (in coroutines.scm) which can be used to
provide await semantics on asynchronous code (so as to remedy inversion
of control), and will work with callbacks for any event loop, including
the glib event loop wrapped by guile-gnome.  More to the point, it also
provides a thread safe event loop for guile (event-loop.scm) with
support for watches on ports/file descriptors, and now supports proper
timeouts, and permits events to be posted by other tasks.  This
includes tasks running on other threads, for which there is a helper
procedure a-sync-run-task-in-thread.

It would be nice to have a monotonic clock available for timeouts where
the system supports it, but guile does not provide that out of the box.
It would therefore be a separate exercise to wrap clock_gettime() with a
CLOCK_MONOTONIC argument to replace the use of the gettimeofday
procedure in event-loop.scm.

Chris

Attachment: coroutines.scm
Description: Text Data

Attachment: event-loop.scm
Description: Text Data

Attachment: example.scm
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]