-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or requestwork in progressIssue currently being worked onIssue currently being worked on
Milestone
Description
Implement a single-producer, single-consumer lock-free queue container and its corresponding policy.
As unbounded queues have reduced real-time applications, the lock-free queue may be bounded.
Interface
(names are placeholders)
// Container
// Same member functions as blocking_queue and others
template<typename T, std::size_t N>
class lock_free_bounded_queue;
// A helper, to convert the template into a type-only one
// It needs to match the signature template<typename...> class Queue on the pipeline
template<std::size_t N>
struct declaration_helper {
template<typename T>
using type = lock_free_bounded_queue<T, N>;
};
// Policy
template<std::size_t N>
inline constexpr tdp::detail::policy_type< declaration_helper<N>::type > queue_lockfree = {};Possible issues
- Bounded queues may require special treatment for a blocked push situation, i.e. full queue.
- Might require a new interface for all containers, symmetric to
pop_unless.
- Might require a new interface for all containers, symmetric to
Possible implementations
As lock-free programming is error-prone, an ideal solution would be importing the data structure from a BSL-compatible library.
Boost.LockFree (BSL)- libcds (BSL)
The atomic_queue benchmarks point a few other options (not all BSL-compatible) and compares their performance. Could be useful.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestwork in progressIssue currently being worked onIssue currently being worked on