MCPcopy Create free account
hub / github.com/Extra-Creativity/Modern-Cpp-Basics / Write

Method Write

13-Multithreading/code/shared_mutex.cpp:18–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16 }
17
18 void Write(int d) {
19 std::lock_guard exclusiveLock{ mutex_ };
20 std::this_thread::sleep_for(300ms); // Assuming we need 300ms to write.
21 data_ = d;
22 }
23private:
24 std::shared_mutex mutex_;
25 int data_ = 0;

Callers 1

mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected