[Vortex] Rebol Script-Binding / Callback Problem

"Robert M. Münch" robert.muench at robertmuench.de
Mon Mar 14 12:44:17 CET 2011


Am 14.03.2011 um 12:21 schrieb Francis Brosnan Blazquez:

>> 1. Is there a way to run Vortex without multi-threading?
> 
> In essense, no. See [1]. You can reduce worker threads to 1, but you
> still have 1 thread for the reader and 1 thread for the sequencer (which
> is the writer).

Hi, ok, that's what I expected and understood too.

I further tracked down the problem. So, it really is the problem that the callback is triggered from a different thread than the interpreter is running in.

>> 3. I used a mutex around the callback code to avoid any multi-thread
>> clashes. No effect, still crashes the interpreter.
> 
> Ok, I'm not aware about rebol engine details, but it certainly looks
> like a threading problem plus the fact you need to acquire some kind of
> global interpreter lock to avoid breaking rebol engine...

There is no such a thing available. I think I "just" need to ensure that the callback is pre-pared & triggered from the thread the interpreter runs in. Is there a simple way how I can call a function from one thread in a different thread's context?

Might not be nice, but I could ensure to call the callback stuff only within the context of the interpreter thread.
 
>> 4. Any other ideas what I could try? I want to note that the chance
>> exists that the problem is in the Rebol-3 interpreter. I just want to
>> track it further down.
> 
> Try to follow previous idea...
> 
> In the other hand, I wouldn't recommend using pull API for you case,
> because you'll need your app to get blocked at the rebol loop, so it can
> process all its stuff (graphics, io), and only call vortex from handlers
> activated vía the user interface...

Yep, it would only be a workaround. But I agree not recommended.

> The idea is to use vortex as usual, setting its handler, etc, and once
> you get called at those handler, you must *do something* before calling
> rebol to ensure that thread is the only one touching rebol engine, and
> later *do something else* after invocation finished to leave other
> handlers and rebol loop interface to continue...

Ok. I'm trying to get in contact with the author and see if I can get some more information about it. Thanks Robert



More information about the Vortex mailing list