| 38 | using namespace std; |
| 39 | |
| 40 | class CryptFileMutex { |
| 41 | private: |
| 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; |
| 46 | public: |
| 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 | |
| 71 | class CryptOpenFile { |
| 72 | private: |
nothing calls this directly
no outgoing calls
no test coverage detected