c++ - Differences between Conditional variables, Mutexes and Locks -


For example

I find it hard to find out which of these things To be cv, mute x and lock). Can someone please explain or point to a resource?

Thanks in regards

Current page that you see, "Mute X" Real low-level synchronization is primitive. You can take a mute x and then leave it, and only one thread can take it any time (hence it is a primitive synchronizing). A recursive mute is the one that can be taken multiple times by the same thread, and then it should be released multiple times as before, before others can take it.

A "lock" here is just a C + + wrapper class that takes a mute in its creator and releases it to the destructor. It is useful for synchronizing for C ++ scops.

An ASB Variable is a more advanced / high-level form of synchronizing primitive, which combines the lock with the "signaling" mechanism. It is used when the formula needs to be waiting to be available. A thread can "wait" on the CV and then the resource creator can "variable" the variable, in this case the thread waiting for the CR is notified and can continue the execution. To avoid race conditions, a mutex is attached to the CV, where a thread wants to indicate the second thread at the same time to wait on the CV; So it is not controllable that is indicated or lost.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -