Annotation of parser3/src/include/pa_os.h, revision 1.16
1.1 paf 1: /** @file
2: Parser: commonly used functions.
3:
1.15 moko 4: Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com)
1.13 moko 5: Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.1 paf 6: */
7:
8: #ifndef PA_OS_H
9: #define PA_OS_H
10:
1.16 ! moko 11: #define IDENT_PA_OS_H "$Id: pa_os.h,v 1.15 2026/04/25 13:38:46 moko Exp $"
1.6 misha 12:
1.7 misha 13: #define PA_LOCK_ATTEMPTS 20
14: #define PA_LOCK_WAIT_TIMEOUT_SECS 0
15: #define PA_LOCK_WAIT_TIMEOUT_USECS 500000
1.6 misha 16:
1.10 moko 17: extern unsigned int pa_lock_attempts;
18:
1.6 misha 19: // 'blocking' mean we will wait till other process release lock
20: // but we'll make PA_LOCK_ATTEMPTS attempts with PA_LOCK_WAIT_TIMEOUT secs delaus between attempts
21: // 'nonblocking' mean we will make only 1 attempt without waiting
1.1 paf 22:
23: int pa_lock_shared_blocking(int fd);
24: int pa_lock_exclusive_blocking(int fd);
25: int pa_lock_exclusive_nonblocking(int fd);
26: int pa_unlock(int fd);
27:
1.2 paf 28: /// yields to OS for secs secs and usecs microseconds (1E-6)
1.1 paf 29: int pa_sleep(unsigned long secs, unsigned long usecs);
30:
1.16 ! moko 31: #ifdef _MSC_VER
! 32: /// sets errno from GetLastError(), as CRT does, if the passed windows api call result is zero; returns it
! 33: int pa_set_errno(int status);
! 34: #endif
! 35:
1.1 paf 36: #endif
E-mail: