Skip to main content

All Questions

2 votes
1 answer
839 views

Efficient parallelization of small tasks

Problem statement: Consider a scenario where a vector of very small tasks, each encapsulated within a class 'Task' with a thread-safe method Task::process(), needs to be efficiently processed in ...
Shakti Malik's user avatar
4 votes
1 answer
126 views

Packet generation and consumption

I have the following simplification of a program which consists of 2 threads. One thread pushes packets to the back of a deque while another waits for user input before performing a "heavy" ...
Bula's user avatar
  • 369
2 votes
1 answer
2k views

C++20 Multi-queue Thread Pool with Work Stealing

This is a follow up to my previous post which also follows up on my first post regarding my thread pool implementation. I have since made some further changes and attempted to improve performance with ...
Developer Paul's user avatar
5 votes
2 answers
2k views

C++20 Single Queue Thread Pool

This is a follow up to my previous post. I've made a number of improvements to the thread pool and corrected some bugs as well. The most up to date version of the code is available on my Github. I ...
Developer Paul's user avatar
2 votes
1 answer
3k views

C++14 Lock-free Multi-producer, Multi-Consumer Queue

Introduction This is a follow-up to a previous question of mine, where I presented another queue of the same type to get some feedback on it. Some people pointed out some fundamental errors I had ...
Primrose's user avatar
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
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
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
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
3 votes
0 answers
1k views

Linked list with hand-over-hand locking

Follow-up to this question: after reading the comments, I decided to redesign my linked list to have a cursor that only contains one node and implement the interface similar to the one of forward_list ...
nhtrnm's user avatar
  • 183
2 votes
1 answer
251 views

Concurrent access to data with QReadWriteLock

Using Qt, I've got this code in order to protect access to some shared data between threads. I'm pretty sure the idea is correct, but I don't know if RVO and/or RAII could potentially screw the ...
Raziel's user avatar
  • 108
4 votes
1 answer
3k views

A "zero copy" concurrent queue in C++ that supports exactly two threads; one for pushing and one for popping

One thread is limited to one action (i.e. there is a push-thread and a pop-thread and the push-thread can't pop and vice versa). By "zero copy" I mean no copying of data (mostly C++ structures) will ...
Chani's user avatar
  • 273

15 30 50 per page