Skip to content

Feat/v0.8.0 threadpool lifecycle#11

Merged
ikelaiah merged 3 commits into
mainfrom
feat/v0.8.0-threadpool-lifecycle
Jul 13, 2026
Merged

Feat/v0.8.0 threadpool lifecycle#11
ikelaiah merged 3 commits into
mainfrom
feat/v0.8.0-threadpool-lifecycle

Conversation

@ikelaiah

Copy link
Copy Markdown
Owner

What does this PR do?

This PR prepares threadpool-fp for the v0.8.0 release by making both thread-pool implementations event-driven, deterministic during shutdown, and safer when tasks fail.

Key changes:

  • Gives both pools the same lifecycle contract:
    tpsAcceptingtpsDrainingtpsStopped.
  • Adds deterministic, idempotent Shutdown.
  • Replaces worker polling sleeps with event-driven signalling.
  • Adds timeout-aware TryQueue(...) and WaitForAll(...) overloads.
  • Prevents task and OnError exceptions from terminating workers or breaking completion accounting.
  • Replaces the Simple pool queue with an O(1) circular FIFO.
  • Makes Producer-Consumer backpressure wait only when the queue is full.
  • Disables debug logging by default.
  • Preserves the existing Queue(...) API so existing programs compile unchanged.
  • Adds lifecycle, timeout, shutdown-race, callback-failure, and queue-saturation tests.
  • Adds benchmarks comparing burst and idle workloads against v0.7.0.
  • Updates the package metadata, API documentation, technical documentation, changelog, and v0.8.0 release notes.

The motivation is to reduce idle latency and queue overhead while making shutdown and failure behaviour consistent and predictable.

Related issue

N/A — v0.8.0 release work.

Type of change

  • 🐛 Bug fix
  • ✨ New feature
  • 📝 Documentation / examples
  • 🔧 Refactor / internal change

Checklist

  • Tests pass locally (lazbuild tests/TestRunner.lpi then run TestRunner)
  • Added/updated tests where it makes sense
  • Updated CHANGELOG.md
  • Updated docs in docs/ if behavior or API changed
  • New units use {$mode objfpc}{$H+}{$J-} and filenames match unit casing

Verification

  • All 58 tests pass with no reported heap leaks.
  • All existing example projects compile unchanged.
  • Package and benchmark projects build successfully.
  • Worker loops contain no polling sleeps.
  • Benchmarks show improved burst throughput and idle wake-up latency compared with v0.7.0.

ikelaiah added 2 commits July 13, 2026 21:56
- unify lifecycle and timeout contracts across both pools
- replace worker polling with event-driven queues
- contain task and error-handler exceptions
- add deterministic shutdown and concurrency tests
- add v0.7.0 comparison benchmarks
- update documentation and release metadata for v0.8.0
@ikelaiah ikelaiah self-assigned this Jul 13, 2026
@ikelaiah ikelaiah added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 13, 2026
@ikelaiah ikelaiah merged commit 726ff37 into main Jul 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant