Skip to main content

All Questions

Tagged with
7 votes
3 answers
1k views

Lock-free multi-producer / multi-consumer queue in C++

I've been working on a lockless multi-producer, multi-consumer queue in an effort to learn as much as I can about concurrency, without the use of mutual exclusion. The queue uses a bounded ring buffer ...
Primrose's user avatar
4 votes
1 answer
189 views

Order guaranteed recursive_transform template function implementation with execution policy in C++

This is a follow-up question for A recursive_transform Template Function with Execution Policy, A recursive_transform Template Function Implementation with std::invocable Concept and Execution Policy ...
JimmyHu's user avatar
  • 5,392
5 votes
2 answers
4k views

C++20 Thread Pool

I've implemented a thread pool using C++20. I'm fairly new to concurrently/multi-threaded programming and wanted to work on a project that I could learn from while also getting to know some of the new ...
Developer Paul's user avatar
3 votes
2 answers
459 views

C++11 revised `std::latch` implementation

This question follows up on this question. After turning the while-loop into a conditional wait using std::condition_variable, I ...
noes's user avatar
  • 43
1 vote
1 answer
451 views

Implementation of a latch

As an exercise to learn more about multi-threading and atomic operations work in C++, I decided to implement a latch class in C++11 loosely based off of std::latch ...
noes's user avatar
  • 43
5 votes
3 answers
1k views

Single Producer Single Consumer lockless ring buffer implementation

I am writing a simple ring buffer for my own education. Below is a crack at a strategy described in http://www.cse.cuhk.edu.hk/~pclee/www/pubs/ancs09poster.pdf : Producer and Consumer keep local ...
samwise's user avatar
  • 59
1 vote
1 answer
123 views

Concurrent dependant routines in a gui application [closed]

The idea is that, in my application I have 5 routines named long_process_1, long_process_2, ...
Aykhan Hagverdili's user avatar
8 votes
0 answers
404 views

Implementing GSL synchronized_value

Core Guidelines mention a type synchronized_value<T>, which supposedly pairs std::mutex with the internal value. I couldn'...
Sergey Kolesnik's user avatar
4 votes
1 answer
987 views

C++ latch implementation

Since std::latch is not in many standard C++ libraries, I tried implementing my own, is it OK from memory ordering perspective or ...
udslk's user avatar
  • 141
1 vote
1 answer
1k views

A multi-thread Producer Consumer, where a Consumer has multiple Producers (C++17) - Part 2

This post is based on A multi-thread Producer Consumer, where a Consumer has multiple Producers (C++17). I am trying to build a Consumer that consumes data from ...
User12547645's user avatar
6 votes
3 answers
3k views

A multi-thread Producer Consumer, where a Consumer has multiple Producers (C++17)

EDID: Thank you very much for your feedback. I updated the code and opened a new post for the updated version. See here. This post is loosely based on A multi-threaded Producer Consumer with C++11. ...
User12547645's user avatar
11 votes
3 answers
6k views

Multi Threaded High Performance txt file parsing

EDIT A port of Björn's answer to C++ with further improvements at bottom achieving up to 2.4GB/s on the reference machine. Text file parsing and processing continues to be a common task. Often it's ...
Oliver Schönrock's user avatar
7 votes
1 answer
116 views

Concurrent Queue Adapter

There's lots of code out there for basic adapters of std::deque to provide a thread-safe queue. I've adopted that, but wanted to provide a relatively full analog to ...
rsjaffe's user avatar
  • 253
4 votes
1 answer
289 views

Determine concurrent access to a function

Someone asked here how to determine a function is being called from multiple threads. My take on this is that they are asking about concurrent access not sequential access. The accepted answer ...
j b's user avatar
  • 141
4 votes
1 answer
535 views

Reader Writer SpinLock

I'm quite new to C++ and want to focus on writing performant multithreaded code because I will try to port our company internal GUI framework which is currently implemented in C#. So I'd love to get ...
Niklas Hauber's user avatar

15 30 50 per page