Documentation
ThreadPool-FP
Run ordinary Pascal procedures concurrently on a managed set of worker threads, without managing threads yourself.
Install ThreadPool-FP and run your first parallel program.
Choose a PoolSimple vs Producer-ConsumerPick the pool that matches your queue-size and backpressure needs.
TasksTasks, Batches & RangesWait for work, coordinate groups, and process ranges efficiently.
BackpressureBounded QueuesControl memory and submission deadlines with a bounded queue.
RecipesCommon TasksCopy tested, compiled Pascal programs for real workloads.
API ReferencePublic APIBrowse the Simple, Tasks, and Producer-Consumer declarations.
ThreadPool-FP is a small, dependency-free thread pool library for Free Pascal and Lazarus. It runs ordinary procedures and object methods across a managed set of worker threads, so you can parallelise work without writing thread runbooks by hand.
It is practical software: four callback forms, two pool styles (unbounded, and a bounded producer-consumer queue), task handles with pending cancellation, worker-error capture, and a clear lifecycle contract.
Getting started#
- Installation & Quick Start — add the units to your project and run the smallest complete program
- Beginner Guide — learn the core ideas in order, from one queued callback to observable tasks and batches
- Choose a Pool — decide between the unbounded
ThreadPool.Simplepool and the boundedThreadPool.ProducerConsumerpool - Cheat Sheet — the operational rules on one page
Guides#
- Callback Forms — the four callback signatures
- Simple Thread Pool —
GlobalThreadPool,TSimpleThreadPool, and the fire-and-forgetQueueworkflow - Tasks & Batches — submit observable work, inspect states, and coordinate groups of handles
- Parallel Ranges — process an inclusive integer range efficiently with
SubmitRange - Cancellation — what cancellation can and cannot do
- Error Handling — worker failures,
LastError,Errors, andOnError - Producer-Consumer Queue — bounded work queues
- Backpressure — submission deadlines and queue monitoring
- Lifecycle & Shutdown — waiting, draining, and stopping a pool cleanly
- Thread Safety — the concurrency contracts you can rely on, and the hazards to avoid
- Platform Requirements —
cthreads, FPC and Lazarus versions, and platform notes - Common Recipes — compiled programs for real tasks
Reference#
Internals#
Project#
This online documentation is versioned. The top-level site opens the current release under /0.9.1/, and the version selector in the header switches between published documentation releases.