[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnome-clutter + repl?
From: |
Mark H Weaver |
Subject: |
Re: gnome-clutter + repl? |
Date: |
Sat, 24 Sep 2011 15:29:14 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
address@hidden writes:
> Anyway, the problem is that clutter needs its own event loop,
> clutter-main, so then I can't simply use the Guile REPL as I'd like.
>
> So these appear to be my choices and I'd appreciate help selecting a
> good approach:
>
> - Don't use the REPL as is, instead make the C application call the
> Guile evaluation routines. Then I must decide things in advance and
> can't use explorative programming
>
> - Make separate threads for the REPL and Clutter. Then I get boring thread
> synchronisation issues.
You could minimize the thread synchronization issues as follows:
* Make a procedure (call-within-clutter-thread THUNK) that arranges for
THUNK to be run within the clutter thread in the near future (and also
arranging for its result to be returned back to the REPL thread),
waits for it to run, and returns the result.
* Optionally make convenience syntax for `call-within-clutter-thread'
that wraps a (lambda () ...) around the provided body.
* Optionally modify the REPL to automatically wrap each expression
within the convenience syntax for `call-within-clutter-thread'.
One way to implement call-within-clutter-thread would be via a job queue
protected by a mutex, where each element in the queue would contain the
thunk to run, a mutable cell in which to place the result, and a
condition variable with which to signal completion of the job.
Mark