int gomp_test_nest_lock_25 (omp_nest_lock_25_t *lock) { int otid, tid = gomp_tid (); otid = __sync_val_compare_and_swap (&lock->owner, 0, tid); if (otid == 0) { lock->count = 1; return 1; } if (otid == tid) return ++lock->count; return 0; }
int gomp_test_nest_lock_25 (omp_nest_lock_25_t *lock) { int otid, tid = gomp_tid (); otid = 0; if (__atomic_compare_exchange_n (&lock->owner, &otid, tid, false, MEMMODEL_ACQUIRE, MEMMODEL_RELAXED)) { lock->count = 1; return 1; } if (otid == tid) return ++lock->count; return 0; }
void gomp_set_nest_lock_25 (omp_nest_lock_25_t *lock) { int otid, tid = gomp_tid (); while (1) { otid = __sync_val_compare_and_swap (&lock->owner, 0, tid); if (otid == 0) { lock->count = 1; return; } if (otid == tid) { lock->count++; return; } do_wait (&lock->owner, otid); } }
void gomp_set_nest_lock_25 (omp_nest_lock_25_t *lock) { int otid, tid = gomp_tid (); while (1) { otid = 0; if (__atomic_compare_exchange_n (&lock->owner, &otid, tid, false, MEMMODEL_ACQUIRE, MEMMODEL_RELAXED)) { lock->count = 1; return; } if (otid == tid) { lock->count++; return; } do_wait (&lock->owner, otid); } }