Hello,
Threadpool with priorities 1.5 (stable version), now you can
use it as a scalable priority MPMC FIFO queue.
Author: Amine Moulay Ramdane
Language: FPC Pascal v2.2.0+ / Delphi 5+:
http://www.freepascal.org/Operating Systems: Win , Linux and Mac (x86).
Description:
Thread Pool Engine.
The following have been added:
- You can give the following priorities to jobs:
LOW_PRIORITY
NORMAL_PRIORITY
HIGH_PRIORITY
- A lock-free queue for each worker thread and it uses work-stealing - for more efficiency -
- Enters in a wait state when there no is job in the queue - for more efficiency -
- You can distribute your jobs to the workers threads and call any method with the threadpool's execute() method.
- Uses O(1) complexity on enqueue and O(3) complexity worst case on dequeue.
Look into defines.inc there is many options:
CPU32: for 32 bits architecture
CPU64: for 64 bits architecture
Please read an article that i wrote about my Threadpool engine: article.
Look at test1.pas example inside the zip file, to show you how to use pthreadpoop engine as a scalable priority MPMC FIFO queue, with this same method you can implement a scalable priority MPMC FIFO queue.
You can download PThreadpool version 1.5 from:
http://pages.videotron.com/aminer/Thank you,
Amine Moulay Ramdane.