| 204 | thread_local photon::mutex aMutex; |
| 205 | |
| 206 | void* thread_test_function(void* arg) |
| 207 | { |
| 208 | LOG_DEBUG(VALUE(CURRENT), " before lock"); |
| 209 | photon::scoped_lock aLock(aMutex); |
| 210 | LOG_DEBUG(VALUE(CURRENT), " after lock"); |
| 211 | |
| 212 | uint32_t* result = (uint32_t*)arg; |
| 213 | |
| 214 | *result += 100; |
| 215 | // for(uint32_t i = 0; i < 100; ++i) |
| 216 | // { |
| 217 | // (*result)++; |
| 218 | // } |
| 219 | |
| 220 | LOG_DEBUG(VALUE(CURRENT), " before sleep"); |
| 221 | photon::thread_usleep(100); |
| 222 | LOG_DEBUG(VALUE(CURRENT), " after sleep"); |
| 223 | |
| 224 | *result += 100; |
| 225 | // for(uint32_t i = 0; i < 100; ++i) |
| 226 | // { |
| 227 | // (*result)++; |
| 228 | // } |
| 229 | |
| 230 | LOG_DEBUG(VALUE(CURRENT), " before yield"); |
| 231 | photon::thread_yield_to(nullptr); |
| 232 | LOG_DEBUG(VALUE(CURRENT), " after yield"); |
| 233 | |
| 234 | *result += 100; |
| 235 | // for(uint32_t i = 0; i < 100; ++i) |
| 236 | // { |
| 237 | // (*result)++; |
| 238 | // } |
| 239 | |
| 240 | aConditionVariable.notify_one(); |
| 241 | aConditionVariable.notify_all(); |
| 242 | |
| 243 | LOG_DEBUG(VALUE(CURRENT), " after notified, about to release lock and exit"); |
| 244 | return arg; |
| 245 | } |
| 246 | |
| 247 | void wait_for_completion(int vcpu_id = -1) |
| 248 | { |
nothing calls this directly
no test coverage detected