| 109 | } |
| 110 | |
| 111 | uint UmtxChain::notify_n(const UmtxKey &key, sint count) { |
| 112 | auto it = sleep_queue.find(key); |
| 113 | if (it == sleep_queue.end()) |
| 114 | return 0; |
| 115 | |
| 116 | uint n = 0; |
| 117 | while (count > 0) { |
| 118 | it->second.thr = nullptr; |
| 119 | it->second.cv.notify_all(mtx); |
| 120 | it = erase(it); |
| 121 | |
| 122 | n++; |
| 123 | count--; |
| 124 | |
| 125 | if (it == sleep_queue.end() || it->first != key) { |
| 126 | break; |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return n; |
| 131 | } |
| 132 | |
| 133 | uint UmtxChain::notify_one(const UmtxKey &key) { return notify_n(key, 1); } |
| 134 |
no test coverage detected