| 232 | } |
| 233 | |
| 234 | void ordering_second(void* arg) { |
| 235 | auto* ctx = reinterpret_cast<OrderingArgs*>(arg); |
| 236 | (void)sys_sleep(30); |
| 237 | (void)ctx->mtx->Lock(); |
| 238 | int prev = ctx->sequence->load(); |
| 239 | ctx->sequence->store(ctx->task_id); |
| 240 | (void)ctx->mtx->UnLock(); |
| 241 | if (prev != 1) { |
| 242 | klog::Err("ordering_second: first writer was {} not 1", prev); |
| 243 | } |
| 244 | sys_exit(0); |
| 245 | } |
| 246 | |
| 247 | void test_mutex_ordering(void* /*arg*/) { |
| 248 | klog::Info("=== Mutex Ordering Test ==="); |