Multithreading in C++, only check if semaphore is locked -


I'm trying to solve a problem, I'm using C ++ on windows.

Assume that I have the thread ABC , and the thread is sending data to an application via the ABC and Z all sockets Z . But when Z is transferring data, I want to wait for AB and CZ, start over again, start over again.

ABC application concurrent

I am trying to use Mutex to prevent ABC from running on jade, but I came to know that whenever Z is not happening, then due to that Mute X ABC Are not walking with.

So my question is finally, is there a way in C ++ which allows me to check that the Mute X is locked and if it is locked, then unlock Mute X Wait for, but no lock Mute X?

I do not want anytime, A, B and C to lock Mute X Only Z should lock the Mute X.

Any help would be appreciated.

There is a type of lock that can solve your problem. Its purpose is for the purpose where there may be many concurrent readers, but at the same time only one writer (and the author locks the readers). It looks like your application, where A, B and C are considered as readers and Z is considered to be a writer.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -