MCPcopy Create free account
hub / github.com/NativeScript/android / AquireWriteLock

Method AquireWriteLock

test-app/runtime/src/main/cpp/ReadWriteLock.cpp:32–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32void ReadWriteLock::AquireWriteLock() {
33 //declare waiting and wait till there are no more active readers or writers and get lock
34 std::unique_lock<std::mutex> lk(shared);
35 waiting_writers++;
36 while ( active_readers != 0 || active_writers != 0 ) { //if any is active wait for them to finish
37 writer_gate.wait(lk);
38 }
39 active_writers++;
40 lk.unlock();
41}
42
43void ReadWriteLock::ReleaseWriteUnlock() {
44 //decrement waiting and active writers

Callers

nothing calls this directly

Calls 1

unlockMethod · 0.80

Tested by

no test coverage detected