|
|
| version 1.12, 2012/03/16 09:24:14 | version 1.16, 2016/11/30 17:01:01 |
|---|---|
| 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-2015 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| 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; |
| # if defined(WIN32) | #ifdef _MSC_VER |
| # include <windows.h> | #include <windows.h> |
| # endif | #endif |
| #ifdef HAVE_FLOCK | #ifdef HAVE_FLOCK |
| Line 57 volatile const char * IDENT_PA_OS_C="$Id | Line 57 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); |
| } | } |
| }; | }; |
| Line 88 int pa_sleep(unsigned long secs, unsigne | Line 88 int pa_sleep(unsigned long secs, unsigne |
| usecs = usecs%1000000; | usecs = usecs%1000000; |
| } | } |
| #ifdef WIN32 | #ifdef _MSC_VER |
| Sleep(secs * 1000 + usecs / 1000); | Sleep(secs * 1000 + usecs / 1000); |
| return 0; | return 0; |
| #else | #else |