123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include <sysdep.h>
- #include <lowlevellock.h>
- #include <pthread-errnos.h>
- .text
- .globl sem_trywait
- .type sem_trywait,@function
- .align 16
- sem_trywait:
- movl (%rdi), %eax
- 2: testl %eax, %eax
- jz 1f
- leal -1(%rax), %edx
- LOCK
- cmpxchgl %edx, (%rdi)
- jne 2b
- xorl %eax, %eax
- retq
- 1:
- #if USE___THREAD
- movq errno@gottpoff(%rip), %rdx
- movl $EAGAIN, %fs:(%rdx)
- #else
- callq __errno_location@plt
- movl $EAGAIN, (%rax)
- #endif
- orl $-1, %eax
- retq
- .size sem_trywait,.-sem_trywait
|