I'm guessing the wait() may be a busy wait and you may need to set the
EventManager timeout:
EventManager setListenTimeout(timeout)
to something reasonable.
On 2009-07-20, at 11:48 AM, Milos Negovanovic wrote:
> Hi,
>
> I am playing with coroutines and Ive came up with this simple example.
> It does work but there is a small problem with it ... while running
> CPU
> usage is constantly at 100%! Anyone might know what am I doing wrong?
>
>
> test1 := Object clone do(
> run := method(
> loop(
> wait(5)
> "5" println
> )
> )
> )
>
> test2 := Object clone do(
> run := method(
> loop(
> wait(1)
> "1" println
> )
> )
> )
>
> server := Socket Server clone
> server setHost("192.168.2.2")
> server setPort(9000)
>
> test1 @@run
> test2 @@run
> server start
>
>
> Regards
> --
> Milos Negovanovic
>
milos.negovanovic@...
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
>