Re: How to determine if task is busy or not?



Tomek Walkuski wrote:
Is there any way to determine if task is busy or not?

I have pool of worker tasks and I want to choose one of them to give
some work to do.

I don't think you should see the problem in these terms. You don't
have to select a task from the pool; the tasks select themselves as
they become available for a new job, e.g. each task would look like

loop
Queue.Get_Next (Job);
Process (Job);
end loop;

where Queue is a protected object and Get_Next removes a job from it
and passes it to the task. Of course, if there are no jobs in the
queue, it blocks until one arrives.

HTH

--
Ludovic Brenta.
.



Relevant Pages

  • Re: Can extra processing threads help in this case?
    ... The number of threads in the pool is normally ... thread queue and setting the maximum concurrency to be the number of CPU cores. ... Completed (updated by OCR process) ... to write some data to the transaction log, ...
    (microsoft.public.vc.mfc)
  • Re: newbee: Simple Backend Python Script Question
    ... I need child threads from a pool to process the queue. ... When there is no stuff in the queue, they go to the pool and become available but they don't terminate. ... So do you close the database connection at the end of the function? ...
    (comp.lang.python)
  • Re: Woodward source pool
    ... Geno poo-poos probable treason against America. ... > they are out of the loop. ... Place your bets in the "Woodward's Source" Pool ...
    (misc.writing)
  • Re: [PATCH 0 of 4] Generic AIO by scheduling stacks
    ... pool, and a queue. ... For the queue approach, I meant the async_submitto simply add the ... I _like_ those synchronous fibrils, ... POVs. ...
    (Linux-Kernel)
  • Re: Connection pool in WinForms app using Data Access Block is exhausting
    ... It occurs in high speed data entry ... > DAAB methods in a loop, and yes we confirmed that no conns were left open) ... > calls quickly in a loop, it might exhaust the conn pool (because pool ...
    (microsoft.public.dotnet.framework.adonet)