OpenMoko light web server
Matthew S. Hamrick
mhamrick at cryptonomicon.net
Tue Apr 17 19:52:12 CEST 2007
I think that you can get an extra thread when you do a request, but
I'm not entirely certain.
The way jowles was designed was that it was event based with a timer
to run the function that queries the server for events. I used the
setTimeout() function to effectively put the main loop to sleep until
a new event or timeout expiry occurred.
But anyway... my point is... even if we are single threaded, the
functions that modify the client data are supposed to complete their
execution quickly. So... yeah... I think the lack of "true" threading
in Javascript is a PITA, but I think we can work around it without
too much distress.
That being said, the whole thing is a hack, and the "real" solution
would have been to embed something like Ruby or Python (or even
Smalltalk) into both the browser and server.
-Cheers
-Matt H.
On Apr 17, 2007, at 7:43 AM, Peter A Trotter wrote:
> Hopefully not wading in half cocked here but...
>
> AFAIK non of the major web browsers implement threading for their
> javascript engines, or at least not within a single window. Hence
> when your asynchronous call returns it does not get executed until
> the current javascript thread terminates. Obviously this is
> unacceptable on the desktop but in terms of web apps it seems the
> right thing to do. That said javascript should only be used to
> enable the interface - we shouldn't be using it for any long
> execution stuff.
>
> -Pete
>
> On 17/04/07, Tim Newsom <cephdon at gmail.com> wrote:
>
> On Tue, 17 Apr 2007 3:54, Alexander E Genaud wrote:
> > Tim,
> >
> > I believe Microsoft created the non-standard XMLHttpRequest object
> > through Active X around IE 5 but it has become something of a
> standard
> > implemented by Firefox, Safari/Konquerer, Opera, and perhaps others.
> > I've been using a nice wrapper, Sarissa, successfully for a few
> years
> > in many environments.
> >
> > http://dev.abiss.gr/sarissa/
> >
> > I believe the asynchronous flag is implemented in those major
> > browsers. Alternatively, you can create an HttpConnection "class"
> with
> > it's own timeout, abort, polling (4K), threading, etc. While the
> > details are different across browsers, it seems that threads never
> > context switches unless explicitly asked to do so (such as Timeouts
> > and alert dialogs). In other words, a "ring" might come in, but
> if you
> > are calculating the Fibonacci numbers to the umpteenth power, the
> > "ring" thread probably won't alert you in good time. I believe
> that is
> > true regardless of the async flag.
> >
> > Alex
>
> Alex,
>
> Hmm, that's interesting... It seems like a poor implementation if you
> can't guarantee that the event will fire asynchronously. Why offer it
> at all? Strange.
>
> --Tim
>
> _______________________________________________
> OpenMoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
>
> _______________________________________________
> OpenMoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openmoko.org/pipermail/community/attachments/20070417/4ce359e3/attachment.htm
More information about the community
mailing list