Re: Translations

Andrew Kohlsmith <[email protected]> Sat, 5 Apr 2003 22:29:02 -0500
Newsgroups gmane.comp.java.xwt.general
Organization Benshaw Canada
Message-ID <[email protected]>
> as mentioned earlier, I want to fetch translation over xmlrpc to
> initialize my application. I know I'm going to have to do this in a
> background thread, but how do I make sure that this thread finishes
> before the rest of the application runs? And how do I make this data
> globally available in all places in my app?

I'm not sure if there is a better solution here, but something like this 
should work for spinlocks:

xwt.thread = function() {
    strings = xwt.xmlrpc(blah);
    gotit = true;
}

main loop:
while(!gotit) { xwt.sleep(100); }

I use that technique in several places and it works well.  I use 
xwt.sleep(100) instead of xwt.yield() just ot help the engine from spinning 
in a tight loop and taking up gobs of processor time.  If 1/10s is too 
detectable in your application you can reduce it or use xwt.yield().

As far as making the data globally available, you should be able to do so by 
placing the data in static.something.

Regards,
Andrew

_______________________________________________
http://lists.xwt.org/listinfo/dev