From: aminer on 24 Mar 2010 04:40 Hello, I have patched Thradpool and to version 1.12.. TPThreadPool.execute look like this - i have used an array of critical sections, and a local variable 'balance'...to avoid some problems... ------------------------------------------------------------------------------------------------------------ function TPThreadPool.execute(func:TmyProc;const Context: Pointer;Priority:byte):Boolean; var params: MyParam; balance:integer; begin //new(params); params:=MYParam.create; params.proc:=func; params.param:=context; balance:=LockedInc(balance1); if (balance=FThreadCount) then begin LockedSub(balance,balance); LockedSub(balance1,balance1); end; cs[balance].enter; while not Queues[balance].push(TObject(params),priority) do; if Queues[balance].count<=1 then events[balance].setevent; cs[balance].leave; end; ----------------------------------------------------------------------------------------- Threadpool with priority have been updated also to 1.12 You can download Threadpool version 1.12 from: http://pages.videotron.com/aminer/ Thank you for your time.. Amine Moulay Ramdane.
|
Pages: 1 Prev: Threadpool with priority version 1.1 ... Next: version numbering or sequence number |