MCPcopy Create free account
hub / github.com/GJDuck/e9patch / mutex_unlock

Function mutex_unlock

examples/stdlib.c:1587–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1585}
1586
1587static __attribute__((__noinline__)) int mutex_unlock(mutex_t *m)
1588{
1589 if (mutex_disabled)
1590 return 0;
1591 pid_t *x = mutex_get_ptr(m);
1592 pid_t self = mutex_gettid();
1593 while (!mutex_fast_unlock(self, x))
1594 {
1595 if (syscall(SYS_futex, x, FUTEX_UNLOCK_PI, 0, NULL, NULL, 0) != 0)
1596 return -1;
1597 if ((pid_t)(*x & ~FUTEX_WAITERS) != self)
1598 break;
1599 }
1600 return 0; // released
1601}
1602
1603static pid_t gettid(void)
1604{

Callers 10

pool_initFunction · 0.85
malloc_implFunction · 0.85
free_implFunction · 0.85
realloc_implFunction · 0.85
freopenFunction · 0.85
stdio_get_streamFunction · 0.85
entryFunction · 0.85
UNLOCKFunction · 0.85
entryFunction · 0.85
entryFunction · 0.85

Calls 3

mutex_get_ptrFunction · 0.85
mutex_gettidFunction · 0.85
mutex_fast_unlockFunction · 0.85

Tested by

no test coverage detected