Hi,

As Stefano wrote...ur loop will never end..:) and no other cycle can be
executed.
This is a concurrency topic and threading, try to create in java(or any
other language)
a thread with while(true) do something, and try to confine some other
thread(some other work) to be done on this thread...
ul see that this can never be done:)

As a example:

Make a java gui with a one button...and inside the EDT(swing thread) make a
endless loop...ull se that ul never be able to catch a
event fired from the button...(this is because the EDT thread will never go
to idle and never get a new task(in case of java a new runnable or calable)
out from the EDT- que.

This is the famous Producer-Consumer pattern.

so basically here is done the same(a program written in a programming
language dose it for u, and its called browser, so the browser engine is the
one responsible for this...and thats why I dont like web programming:)
i dont have the overview of what is happening, and usually strange things
happens:) )

regards


On Sun, Sep 19, 2010 at 2:00 PM, Stefano Ciccarelli <
[email protected]> wrote:

> There is no preemption. The events are polled when the thread is idle
> and in your example the thread is not idle because is stuck in your
> endless and freezing cycle.
>
> On Sunday, September 19, 2010, Johannes Lehmann
> <[email protected]> wrote:
> > I appreciate that with JavaScript interpreters executing in one thread
> > there will never be any *true* concurrency. However it seems perfectly
> > possible for concurrency issues to arise with the way that
> > asynchronous callbacks are used  A simple example is if I am
> > continuously checking the value of a variable x, and then incrementing
> > it:
> > while(!stop) {
> >   int i = x;
> >   x = i+1;
> > }
> >
> > Once the event occurs, the handler prints the variable and sets a flag
> > that causes the incrementing to stop:
> > print(x);
> > stop = true;
> >
> > The intended behavior might be that the final value of the counter is
> > printed. However if the event handler is invoked right after the
> > assignment 'int i = x', the value will be incremented one more time
> > after it is printed, which is a concurrency bug.
> >
> > In such cases the synchronized keyword could have been used to define
> > pieces of code which must not be interrupted by other pieces of code
> > in such way. In plain Java the synchronized keyword provides an easy
> > way of dealing with such issues. The problem I described in my first
> > post is very similar to this in nature and I am lost as to what to do.
> >
> > I hope this makes what I mean a bit clearer. Of course I am not
> > excluding the possibility that I just misunderstood somthing about how
> > the GWT/JavaScript eventing mechanism works.
> >
> > Thanks,
> >
> > Johannes
> >
> > On Sep 17, 5:40 pm, Thomas Broyer <[email protected]> wrote:
> >> On Sep 17, 4:13 pm, Johannes Lehmann
> >>
> >> <[email protected]> wrote:
> >> > OK, that is basically what I assumed. This however seems to create
> >> > concurrency issues, which the synchronized keyword was designed to
> >> > address. Without any language support such as semaphores or mutexes
> >> > and without any guarantees regarding preemption, how could I solve a
> >> > problem such as the above?
> >>
> >> Excuse my ignorance about semaphores/mutexes/preemption details, but
> >> how can there be concurrency issues if things never execute
> >> concurrently? (and *your* code will never execute concurrently with
> >> *your* code)
> >>
> >> If you really want the gory details:
> http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapi...
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> > To post to this group, send email to [email protected]
> .
> > To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
> >
> >
>
> --
> *Stefano Ciccarelli*
> [email protected]
>
> *Indaco srl*
> via Sabin, 22 - 40017 San Giovanni in Persiceto (BO) - Italy
> tel. +39.051.827762 - fax +39.051.6874570
> [email protected]
> www.indacosoftware.it
>
> *- This e-mail is confidential and may be read, copied and used only by the
> intended recipient. If you have received it in error, please contact the
> sender immediately by return e-mail. Please then delete the e-mail and do
> not disclose its contents to any other person.
>
> - Le informazioni contenute in questa comunicazione sono riservate e
> destinate esclusivamente alla/e persona/e o all'ente sopra indicati. E'
> vietato ai soggetti diversi dai destinatari qualsiasi uso, copia,
> diffusione
> di quanto in esso contenuto sia ai sensi dell'art. 616 c.p., sia ai sensi
> del DL n. 196/03. Se questa comunicazione Vi e' pervenuta per errore, Vi
> preghiamo di rispondere a questa e-mail e successivamente cancellarla dal
> Vostro sistema.*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to