Skip to content

jali-clarke/cpp-mvar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

cpp-mvar

Mutexed variables

For those familiar with Haskell, an MVar is like a box which either has data or does not. It is primarily used for message passing and synchronization between threads. If an MVar has data, taking data out will set its state to open. If an MVar does not have data, putting data in will set its state to closed. If you try to take data out from an open MVar, the thread will block until it is closed. Similarly, if you try to put data into a closed MVar, the thread will block until the MVar is open.

Run the demonstration program multiple times (~15 times maybe). The unsynched version may not always return 10000. The synched version will (should) always return 10000.

Requires at least C++11.

About

Mutexed variables

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages