22 lines
277 B
C
22 lines
277 B
C
|
int owner();
|
||
|
int clear();
|
||
|
|
||
|
static void fixup() {
|
||
|
clear();
|
||
|
}
|
||
|
|
||
|
inline __attribute__ ((always_inline))
|
||
|
void slowtrylock(void) {
|
||
|
if (owner())
|
||
|
fixup();
|
||
|
}
|
||
|
|
||
|
void fasttrylock(void (*slowfn)()) {
|
||
|
slowfn();
|
||
|
}
|
||
|
|
||
|
void trylock(void) {
|
||
|
fasttrylock(slowtrylock);
|
||
|
}
|
||
|
|