Diff for /parser3/src/main/pa_os.C between versions 1.14 and 1.21

version 1.14, 2013/07/23 21:32:18 version 1.21, 2024/11/04 03:53:25
Line 1 Line 1
 /** @file  /** @file
         Parser: commonly functions.          Parser: commonly functions.
   
         Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com)          Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com)
         Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)          Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
 */  */
   
 #include "pa_config_includes.h"  #include "pa_config_includes.h"
Line 10 Line 10
   
 volatile const char * IDENT_PA_OS_C="$Id$" IDENT_PA_OS_H;   volatile const char * IDENT_PA_OS_C="$Id$" IDENT_PA_OS_H; 
   
   unsigned int pa_lock_attempts=PA_LOCK_ATTEMPTS;
   
 #ifdef _MSC_VER  #ifdef _MSC_VER
 #include <windows.h>  #include <windows.h>
 #endif  #endif
Line 57  volatile const char * IDENT_PA_OS_C="$Id Line 59  volatile const char * IDENT_PA_OS_C="$Id
 int pa_lock(int fd, int attempts, int operation){  int pa_lock(int fd, int attempts, int operation){
         while(true){          while(true){
                 FLOCK(operation);                  FLOCK(operation);
                 attempts--;                  if(status==0)
                 if(status==0 || attempts<=0){                          return 0;
                         return status;                  if(--attempts<=0)
                 }                          return errno;
                 pa_sleep(PA_LOCK_WAIT_TIMEOUT_SECS, PA_LOCK_WAIT_TIMEOUT_USECS);                  pa_sleep(PA_LOCK_WAIT_TIMEOUT_SECS, PA_LOCK_WAIT_TIMEOUT_USECS);
         }          }
 };  };
   
 int pa_lock_shared_blocking(int fd) {  int pa_lock_shared_blocking(int fd) {
         return pa_lock(fd, PA_LOCK_ATTEMPTS, PA_SH_LOCK);          return pa_lock(fd, pa_lock_attempts, PA_SH_LOCK);
 }  }
   
 int pa_lock_exclusive_blocking(int fd) {  int pa_lock_exclusive_blocking(int fd) {
         return pa_lock(fd, PA_LOCK_ATTEMPTS, PA_EX_LOCK);          return pa_lock(fd, pa_lock_attempts, PA_EX_LOCK);
 }  }
   
 int pa_lock_exclusive_nonblocking(int fd) {  int pa_lock_exclusive_nonblocking(int fd) {

Removed from v.1.14  
changed lines
  Added in v.1.21


E-mail: