--- parser3/src/main/pa_os.C 2013/07/23 21:32:18 1.14 +++ parser3/src/main/pa_os.C 2016/11/30 17:01:01 1.16 @@ -1,14 +1,14 @@ /** @file Parser: commonly functions. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #include "pa_config_includes.h" #include "pa_os.h" -volatile const char * IDENT_PA_OS_C="$Id: pa_os.C,v 1.14 2013/07/23 21:32:18 moko Exp $" IDENT_PA_OS_H; +volatile const char * IDENT_PA_OS_C="$Id: pa_os.C,v 1.16 2016/11/30 17:01:01 moko Exp $" IDENT_PA_OS_H; #ifdef _MSC_VER #include @@ -57,10 +57,10 @@ volatile const char * IDENT_PA_OS_C="$Id int pa_lock(int fd, int attempts, int operation){ while(true){ FLOCK(operation); - attempts--; - if(status==0 || attempts<=0){ - return status; - } + if(status==0) + return 0; + if(--attempts<=0) + return errno; pa_sleep(PA_LOCK_WAIT_TIMEOUT_SECS, PA_LOCK_WAIT_TIMEOUT_USECS); } };