Hello,

Thursday, February 19, 2004, 9:31:59 AM, Robert Friberg wrote:

RF> A solution could be to create a fixed number of threads and let them
RF> fetch work from a shared array.

Thanks for all your help!

Your example was very helpful for me: I am creating
workers-threads, they are work continuously all time
during the programm runs.
I am trying to add interactivity : user should to be able to add new
"task" any time. In inactivity the thread(s) should be suspended or
sleeping.

But it seems that on Windows sleep(N) and
select(undef,undef,undef,N) stop whole process and not a current
thread. The Thread::Suspend and Thread::Signal seems dont work on
Win32.

If I try to loop the thread I get 100% CPU usage:

# run continuously
while (1) {
      # do nothing if there are no job
    if ( @work < 1) { threads->self->yield; next };
    {
      lock @work;
      $url = pop @work;
    }
    # lwp stuff here
    ...
}

How can I otherwise temprarily stop or suspend the thread?
or loop without to take a lot of CPU-Time ?


-- 
Best regards,
Pavel                            mailto:[EMAIL PROTECTED]

Reply via email to