Annotation of parser3/src/include/pa_os.h, revision 1.12
1.1 paf 1: /** @file
2: Parser: commonly used functions.
3:
1.12 ! moko 4: Copyright (c) 2001-2020 Art. Lebedev Studio (http://www.artlebedev.com)
1.1 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
6: */
7:
8: #ifndef PA_OS_H
9: #define PA_OS_H
10:
1.12 ! moko 11: #define IDENT_PA_OS_H "$Id: pa_os.h,v 1.11 2017/02/07 22:00:35 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:
31: #endif
E-mail: