1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include <errno.h>
- #include <sysdep.h>
- #include <lowlevellock.h>
- #include <internaltypes.h>
- #include <semaphore.h>
- int
- __new_sem_trywait (sem_t *sem)
- {
- int *futex = (int *) sem;
- int val;
- if (*futex > 0)
- {
- val = atomic_decrement_if_positive (futex);
- if (val > 0)
- return 0;
- }
- __set_errno (EAGAIN);
- return -1;
- }
- weak_alias(__new_sem_trywait, sem_trywait)
|