libthreadable ; benchmarks
TLDR
libthreadable is a C++ library for cache-aware, concurrent task execution using
a thread pool with lock-free queues. It simplifies parallel programming by managing
threads and task distribution for performance-critical applications.
Example
#include <threadable/pool.hxx>
int main() {
// thread pool:
auto pool = fho::pool();
auto& queue = pool.create();
auto token = queue.emplace_back( []() { cout << "task executed!\n"; });
token.wait();
// generic ring buffer:
auto ring = fho::ring_buffer<int>();
ring.emplace_back(1);
ring.emplace_back(2);
ring.emplace_back(3);
assert(ring.size() == 3);
for (auto v : ring)
{
cout << format("{}\n", v); // prints 1 2 3
}
assert(ring.size() == 3);
while (auto v = ring.try_pop_front())
{
cout << format("{}\n", *v); // prints 1 2 3
}
assert(ring.size() == 0);
return 0;
}
Design Overview
Thread Pool (pool) + Worker Threads (executor):
Manages multiple task queues and worker threads,
orchestrating task distribution to executors running
in dedicated threads via a scheduler.
task Queues (ring_buffer):
Lock-free multi-producer, multi-consumer ring buffer
to store tasks.
Ring Iterator (ring_iterator) + Slot (ring_slot):
Support the ring_buffer with efficient random access
and state management for buffer elements.
| version | 0.2.2 |
|---|---|
| license | MITMIT License |
| repository | https://pkg.cppget.org/1/alpha |
| download | libthreadable-benchmarks-0.2.2.tar.gz |
| sha256 | 6ed29af662a9b7c7173ba10092731d3a2418ae0bf9e70fcc173fca5b4b12797f |
| project | threadable |
|---|---|
| url | github.com/helmesjo/threadable |
| helmesjo@gmail.com |
Depends (2)
| doctest ^2.4.7 | |
| libnanobench ^4.3.11 |
Reviews
| fail | 0 |
|---|---|
| pass | 0 |