Compare threading features with other libraries
Functionality | xtd | std | Boost | Qt | wxWidgets | Poco | ACE | TBB | Comments / Roadmap |
---|---|---|---|---|---|---|---|---|---|
Mutex re-entering | ✅ | ✅ (recursive_mutex ) | ✅ | ✅ (QRecursiveMutex) | ✅ | ✅ (FastMutex) | ✅ | ✅ | Default Recursive |
Mutex non-re-entrant | ✅ | ✅ | ✅ | ✅ (QMutex) | ✅ | ✅ | ✅ | ✅ | |
Named Mutex / inter-process | ✅ | ❌ | ❌ | ✅ (QSystemSemaphore/QSharedMemory) | ✅ | ✅ | ✅ | ❌ | Unique to xtd for simple API |
Semaphore | ✅ | ✅ (counting_semaphore ) | ✅ | ✅ (QSystemSemaphore) | ✅ | ✅ | ✅ | ❌ | |
Named Semaphore / inter-process | ✅ | ❌ | ❌ | ✅ (QSystemSemaphore) | ❌ | ✅ | ✅ | ❌ | Very easy to use |
EventWaitHandle / Manual / AutoResetEvent | ✅ | ❌ | ❌ | ✅ (QWaitCondition + QMutex) | ❌ | ✅ (Event) | ✅ | ❌ | Inter-process support if named |
Monitor-style / lock_guard | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | lock on monitor, lock_guard on mutex |
SpinLock | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | |
Barrier / CountdownEvent | ✅ | ❌ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | |
Thread / jthread / thread_start | ✅ | ✅ | ✅ | ✅ (QThread) | ✅ | ✅ | ✅ | ✅ | jthread = Automatic joint |
ThreadPool | ✅ | ❌ | ✅ (Boost::asio/threadpool) | ✅ (QThreadPool) | ❌ | ✅ | ✅ | ✅ | Timer can run via thread pool |
Thread exceptions / Abort / Interrupt | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | Unique to xtd + ACE |
Thread local storage | ✅ | ✅ (thread_local ) | ✅ | ✅ (QThreadStorage) | ✅ | ✅ | ✅ | ✅ | |
Interlocked / atomic operations | ✅ | ✅ (std::atomic ) | ✅ | ✅ (QAtomic) | ✅ | ✅ | ✅ | ✅ | |
Timer simple | ✅ (xtd::timers::timer ) | ❌ | ✅ | ✅ (QTimer) | ✅ | ✅ | ✅ | ✅ | Regular events, multi-thread safe |
Timer on thread pool | ✅ (xtd::threading::timer ) | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | Automatic callback on thread pool |
Timer UI single-thread | ✅ (xtd::forms::timer ) | ❌ | ❌ | ✅ (QTimer) | ✅ | ❌ | ❌ | ❌ | Execution on UI thread for GUI |
Futures / Promises | ❌ | ✅ (std::future ) | ✅ | ✅ (QFuture) | ❌ | ✅ | ✅ | ✅ | Can stay in std, not priority for xtd |
Tasks / async abstractions | ⚡ (To come) | ✅ (std::async ) | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | Will integrate with thread_pool and delegate::begin/end_invoke |
Condition complex variables | ✅ | ✅ | ✅ | ✅ (QWaitCondition) | ✅ | ✅ | ✅ | ✅ | |
Deadlock detection / debugging primitives | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | automatic detection; but debugging support via thread names, thread_state , and debugger integration (VS, Xcode, gdb) |
Priority inheritance mutex | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | Specialized real-time / embedded use |
Thread affinity / CPU pinning | ✅ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ❌ | Useful for performance optimization |
Cancelable tasks / futures | ⚡ (To come) | ❌ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | Xtd can integrate it via task abstraction |
Legend
- ✅ = Implemented
- ❌ = Not implemented
- ⚡ = Planned or in progress
See also