You could have it check for messages in the loop.
That shouldn't be that hard to do.

AJ00200
Web War Lord

On Jul 8, 11:44 am, Sergio Viudes <[email protected]> wrote:
> Thanks for your responses. I tested with IE7 and worked OK with
> setTimeout and 0 miliseconds. I'll test in firefox 3.5 when gears be
> available. I don't know why doesn't work well on firefox 3 under
> ubuntu...
>
> On 8 jul, 18:15, skye <[email protected]> wrote:
>
>
>
> > Obviously I don't know the internals/details of your application, so I
> > don't know if it makes sense to have two concurrent workers.
>
> > If the messages being handed to the worker are defendant/related to
> > the work being done in your loop then it doesn't make sense to have
> > two workers.  If however the processing done in the loop is
> > independent from the information being passed in the messages then you
> > could just instantiate another worker and pass it the messages for
> > processing.
>
> > I cannot think of any other strategies to speed up this issue right
> > now, but I am pretty new to gears as well.
>
> > -s
>
> > On Jul 8, 2:25 am, Sergio Viudes <[email protected]> wrote:
>
> > > I used a timer to pause execution 100 miliseconds each loop and
> > > messages are processed ok, but execution is very slow!. I set
> > > miliseconds to 10 instead of 100, but message is processed too late.
>
> > > About your second solution, how can I do it? I need the worker could
> > > process the message to stop the loop when message is received. If I
> > > create another worker, how can I stop the loop in the worker when
> > > message is handled by another worker?
>
> > > thanks
>
> > > On 8 jul, 00:36, skye <[email protected]> wrote:
>
> > > > Perhaps instead of having a constantly executing loop, you could set
> > > > up a Timer and have the loop execute at fixed times.  This way your
> > > > worker thread would have free cycles to process the onMessage events?
> > > > Or maybe start another instance of a worker to specifically handle the
> > > > messages while the other worker processes in the loop?
>
> > > > -s
>
> > > > On Jul 7, 12:29 pm, Sergio Viudes <[email protected]> wrote:
>
> > > > > I wrote a worker that has a big loop. If I send a message to this
> > > > > worker while loop is executing, it isn't readed until loop ends. I
> > > > > need message can be readed while executing that loop.
>
> > > > > Anybody has any ideas?
>
> > > > > Thanks

Reply via email to