Fn77 - use -2 return value for EWOULDBLOCK.

git-svn-id: svn://kolibrios.org@6089 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-01-23 02:36:00 +00:00
parent 3f61ba72bb
commit 419012b345
2 changed files with 11 additions and 9 deletions

View File

@ -132,10 +132,10 @@ align 4
jnz .futex_wait_timeout jnz .futex_wait_timeout
mov ecx, [ebp+FUTEX.pointer] mov ecx, [ebp+FUTEX.pointer]
mov eax, edx mov eax, edx
lock cmpxchg [ecx], edx ;wait until old_value == new_value lock cmpxchg [ecx], edx
jz .wait_slow je .wait_slow
mov [esp+SYSCALL_STACK._eax], 0 mov [esp+SYSCALL_STACK._eax], -2
ret ret
.wait_slow: .wait_slow:
@ -148,13 +148,13 @@ align 4
lea esi, [ebp+FUTEX.wait_list] lea esi, [ebp+FUTEX.wait_list]
list_add_tail esp, esi ;esp= new waiter, esi= list head list_add_tail esp, esi ;esp= new waiter, esi= list head
mov eax, edx
.again: .again:
mov [ebx+TASKDATA.state], 1 mov [ebx+TASKDATA.state], 1
call change_task call change_task
lock cmpxchg [ecx], edx lock cmpxchg [ecx], edx
jz .again je .again
list_del esp list_del esp
add esp, sizeof.MUTEX_WAITER add esp, sizeof.MUTEX_WAITER
@ -174,9 +174,9 @@ align 4
mov ecx, [ebp+FUTEX.pointer] mov ecx, [ebp+FUTEX.pointer]
mov eax, edx mov eax, edx
lock cmpxchg [ecx], edx ;wait until old_value == new_value lock cmpxchg [ecx], edx ;wait until old_value == new_value
jz .wait_slow_timeout je .wait_slow_timeout
mov [esp+SYSCALL_STACK._eax], 0 mov [esp+SYSCALL_STACK._eax], -2
ret ret
align 4 align 4
@ -210,6 +210,7 @@ align 4
test eax, eax test eax, eax
jz .timeout jz .timeout
mov eax, edx
lock cmpxchg [ecx], edx lock cmpxchg [ecx], edx
jz .again_timeout jz .again_timeout
@@: @@:

View File

@ -4794,8 +4794,9 @@ Parameters:
* edx = control value * edx = control value
* esi = timeout in system ticks or 0 for infinity * esi = timeout in system ticks or 0 for infinity
Returned value: Returned value:
* eax = 0 - successfull, -1 on timeout * eax = 0 - successfull
-1 - timeout
-2 - futex dword does not have the same value as edx
Remarks: Remarks:
* This functionn tests that the value at the futex dword still * This functionn tests that the value at the futex dword still
contains the expected control value, and if so, then sleeps contains the expected control value, and if so, then sleeps