| 71 | |
| 72 | private: |
| 73 | struct Data |
| 74 | { |
| 75 | Data() : locked(false) {} |
| 76 | |
| 77 | ~Data() |
| 78 | { |
| 79 | // TODO(benh): Fail promises? |
| 80 | } |
| 81 | |
| 82 | // Rather than use a process to serialize access to the mutex's |
| 83 | // internal data we use a 'std::atomic_flag'. |
| 84 | std::atomic_flag lock = ATOMIC_FLAG_INIT; |
| 85 | |
| 86 | // Describes the state of this mutex. |
| 87 | bool locked; |
| 88 | |
| 89 | // Represents "waiters" for this lock. |
| 90 | std::queue<Promise<Nothing>> waiters; |
| 91 | }; |
| 92 | |
| 93 | std::shared_ptr<Data> data; |
| 94 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected