[Vortex] Rebol Script-Binding / Callback Problem

Sam Roberts vieuxtech at gmail.com
Tue Mar 15 18:21:08 CET 2011


On Tue, Mar 15, 2011 at 2:24 AM, Francis Brosnan Blazquez
<francis at aspl.es> wrote:
> In cases where the language/gui does not support a global lock, I think
> you can integrate vortex by using a VortexAsyncQueue [1].

Yes, that's the approach I described in paragraph 3, its basically
building a new api on top of vortex.

Either way, its a lot of work. Gatewaying through http+json would be
easier. Or even gatewaying http/soap into beep/soap, which I think
vortex supports.

The async queue might work, might not, at the time I looked it seemed
that some callbacks had return values, so you couldn't queue their
args as an event and then return, you'd have queue the args, then
block waiting for an event to come back. Whether this would block
threads for too long, I don't know. My attempt at this failed, I got
intermittent deadlocks. Probably I was doing something wrong, but
having the full pain of threads thrust upon me in my attempt to
unthread felt unpleasantly ironic.

Honestly, Francis, I don't understand why vortex doesn't use a
single-threaded event-based model. Threads are useful for servers that
can block on disk I/O, but network connections have supported i/o
multiplexing for a long time. The decision to use threads in a library
forces apps using vortex to be threaded (or to somehow dethread using
some sync mechanism), which is a pretty fundamental architectural
decision to be pushed onto an application by a library. Its simple to
use an event-based library in a multi-threaded app, using a
multithreaded library in an event-based or single-threaded app is
possibe, but not easy.

Its not just interpreter cores that are hostile to multi-threading,
every gui library I've ever heard of is, too. I tried to build a
simple GUI chat client with QT and vortex, every callback had to post
things back to the thread main loop. Quite painful.

We have this problem at work with beep4j, too, It isn't as
multi-threaded as vortex, but its threaded enough we need to be
careful with it - our client app is a gui, and even java gui's don't
allow interaction with multiple threads, you need to post events from
threads back to it.

Cheers,
Sam


More information about the Vortex mailing list