Re: [Hecl-devel] Issue with synchronized eval
Brought to you by:
davidw
From: Wolfgang S. K. <wol...@da...> - 2008-01-18 12:32:51
|
David Welton wrote: > The synchronized eval appears to cause some problems for http.geturl. > I'm investigating... > I spent some time on the synchronized problem and it appears to be more complex on j2me devices than I expected. Let's look at the following scenario: script performing (sketch): proc timer {} { puts timer after 1000 timer } proc main {} { timer while 1 { set start [clock time] http.geturl http://www.x.org puts "http: [- [clock time] $start]s"; } } main I expect the timer to fire every second, even when the http connection waits for an answer from the server. The current implemetation yields the expected result, but the http-call takes more time than expected on j2me devices. The problem seems to be in the implementation of doOneEvent, but I need to spend more time on the issue. One option that came into my mind is to make the interpreter save to be called from multiple threads, but this would require the evaluation stack to be passed down explictly, so we have protected interp.eval(Thing,CallStack) public interp.eval(Thing) Hecl will use the internal first method whereas external callers use the latter. Unfortunately this approach requires all command implementations in Java to have the stack as additional calling parameter as well :-( Since this is a major change, I will look for other solutions first. Remind: On j2se, the problem does not occur. I guess thread handling and synchronization is done quite different in j2me. Does anybody have experience with the behavior on android? -- Wolfgang Kechel mailto:wol...@da... data2c GmbH http://www.data2c.com Bierstadter Straße 7 Fax: +49-(0)611-1731-31 D-65189 Wiesbaden Phone: +49-(0)611-1731-611/+49-(0)174-3454260 |