MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / CryptFileMutex

Class CryptFileMutex

libcppcryptfs/file/openfiles.h:40–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38using namespace std;
39
40class CryptFileMutex {
41private:
42 // the outer mutex is for fairness so exclusive lockers can get in
43 // because they need to do only a small portion of their work in exclusive mode
44 mutex m_outer_mutex;
45 shared_mutex m_inner_mutex;
46public:
47 void lock()
48 {
49 lock_guard<mutex> lck(m_outer_mutex);
50 m_inner_mutex.lock();
51 }
52
53 void lock_shared()
54 {
55 lock_guard<mutex> lck(m_outer_mutex);
56 m_inner_mutex.lock_shared();
57 }
58
59 void unlock()
60 {
61 m_inner_mutex.unlock();
62 }
63
64 void unlock_shared()
65 {
66 m_inner_mutex.unlock_shared();
67 }
68
69};
70
71class CryptOpenFile {
72private:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected