From 419012b345212fae8addc0782a39351d523d58d6 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sat, 23 Jan 2016 02:36:00 +0000 Subject: [PATCH] Fn77 - use -2 return value for EWOULDBLOCK. git-svn-id: svn://kolibrios.org@6089 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/sync.inc | 15 ++++++++------- kernel/trunk/docs/sysfuncs.txt | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/kernel/trunk/core/sync.inc b/kernel/trunk/core/sync.inc index afabc4c647..969e9505a9 100644 --- a/kernel/trunk/core/sync.inc +++ b/kernel/trunk/core/sync.inc @@ -132,10 +132,10 @@ align 4 jnz .futex_wait_timeout mov ecx, [ebp+FUTEX.pointer] mov eax, edx - lock cmpxchg [ecx], edx ;wait until old_value == new_value - jz .wait_slow + lock cmpxchg [ecx], edx + je .wait_slow - mov [esp+SYSCALL_STACK._eax], 0 + mov [esp+SYSCALL_STACK._eax], -2 ret .wait_slow: @@ -148,13 +148,13 @@ align 4 lea esi, [ebp+FUTEX.wait_list] list_add_tail esp, esi ;esp= new waiter, esi= list head - + mov eax, edx .again: mov [ebx+TASKDATA.state], 1 call change_task lock cmpxchg [ecx], edx - jz .again + je .again list_del esp add esp, sizeof.MUTEX_WAITER @@ -174,9 +174,9 @@ align 4 mov ecx, [ebp+FUTEX.pointer] mov eax, edx 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 align 4 @@ -210,6 +210,7 @@ align 4 test eax, eax jz .timeout + mov eax, edx lock cmpxchg [ecx], edx jz .again_timeout @@: diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index edb9a382c5..e559d12068 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -4794,8 +4794,9 @@ Parameters: * edx = control value * esi = timeout in system ticks or 0 for infinity 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: * This functionn tests that the value at the futex dword still contains the expected control value, and if so, then sleeps