I am writing a multi-threaded program using OpenMP in C ++. At some point, my program plugs into many threads, each of which must add “jobs” to some container that tracks all added jobs. Each task can be a pointer to an object.
Basically, I just need to add pointers to some container from several threads at the same time.
Is there a simple solution that works well? After some searches, I found that STL containers are not thread safe. Some qaru.site/questions/1030118 / ... consider this question, but none of them had consensus on a simple solution.
source
share