I have a few of threads in charge of the communication sessions respectively. Each of them will execute a small piece of code, that just copys a struct into a queue(one que for one thread, for lock-free), when they receive some data.
I don't want they be suspended during enquing the data, so that I can ensure some consistency of timing(first received first enqued), as well as let this critical section(enquing) be executed as fast as possible.
I know it can be resolved with a lock and by using single queue for all threads, but I don't want some of them be blocked to wait for accquiring the lock.
Is there a way in c++ to resolve this issue? I'm using gcc-8.2.0 and stl in a linux box.
In the fact, I'm expecting a method, with it I can define a "critical-section" of codes. When threads are executing inside such section, they would never be suspended/blocked by OS.
Sorry for my poor English, hope I has expressed things correctly. Thanks!