[haXe] Thread communication

Nicolas Cannasse ncannasse at motion-twin.com
Thu Feb 15 16:24:55 CET 2007


> Right... I have a main thread and a child thread in my application. On 
> creation, the child thread is passed the handle to the threads creator. 
>  From there, the creator thread goes into an infinite SWHX loop, which 
> is fine, but I need the child thread to interact with the SWHX objects 
> held in the creator thread, without using the sendMessage / readMessage 
> pair (due to the loop).  Currently, I can't seem to do this, as I'm not 
> sure how to extract the path to the objects via the thread handle.  Is 
> this even possible?

Yes, it's possible.
You need to use the SWHX sync_call function which is not exported by 
default :

var sync_call : (Void -> Void) -> Void = 
neko.Lib.load("swhx","sync_call",1);

sync_call(myMethod);
// will execute myMethod in the SWHX loop

Nicolas





More information about the Haxe mailing list