| 122 | static std::condition_variable comparingCond; |
| 123 | |
| 124 | void bitmapCompareThread(Player* player) { |
| 125 | while (comparingPixels != COMPARING_PIXELS_DONE) { |
| 126 | { |
| 127 | std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex); |
| 128 | comparingCond.wait(boxedWineCriticalSection); |
| 129 | if (comparingPixels == COMPARING_PIXELS_DONE) { |
| 130 | break; |
| 131 | } |
| 132 | comparingPixels = COMPARING_PIXELS_WORKING; |
| 133 | } |
| 134 | if (outputLen < bufferlen) { |
| 135 | if (output) { |
| 136 | delete[] output; |
| 137 | } |
| 138 | output = new U8[bufferlen]; |
| 139 | outputLen = bufferlen; |
| 140 | } |
| 141 | if (pixelmatch(image_data, image_width * 4, buffer, image_width * 4, image_width, image_height, output) == 0) { |
| 142 | std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex); |
| 143 | if (comparingPixels == COMPARING_PIXELS_DONE) { |
| 144 | break; |
| 145 | } |
| 146 | comparingPixels = COMPARING_PIXELS_SUCCESS; |
| 147 | } else { |
| 148 | std::unique_lock<std::mutex> boxedWineCriticalSection(comparingCondMutex); |
| 149 | if (comparingPixels == COMPARING_PIXELS_DONE) { |
| 150 | break; |
| 151 | } |
| 152 | comparingPixels = COMPARING_PIXELS_WAITING; |
| 153 | } |
| 154 | Platform::nanoSleep(500000l); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | void Player::runSlice() { |
| 159 | // at least 10 ms between mouse moves |
nothing calls this directly
no test coverage detected