lock.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef SYS_LOCK_H
23 #define SYS_LOCK_H
24 
25 #ifndef DOXYGEN
26 
27 #include <stdint.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #if !defined(_RETARGETABLE_LOCKING)
34 
35 typedef void * _lock_t;
36 
37 #define _LOCK_T _lock_t
38 #define _LOCK_RECURSIVE_T _lock_t
39 
40 void _lock_init(_lock_t *lock);
41 void _lock_init_recursive(_lock_t *lock);
42 void _lock_close(_lock_t *lock);
43 void _lock_close_recursive(_lock_t *lock);
44 void _lock_acquire(_lock_t *lock);
45 void _lock_acquire_recursive(_lock_t *lock);
46 int _lock_try_acquire(_lock_t *lock);
47 int _lock_try_acquire_recursive(_lock_t *lock);
48 void _lock_release(_lock_t *lock);
49 void _lock_release_recursive(_lock_t *lock);
50 
51 #else /* !defined(_RETARGETABLE_LOCKING) */
52 
53 #include_next <sys/lock.h>
54 
55 #endif /* !defined(_RETARGETABLE_LOCKING) */
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* DOXYGEN */
62 #endif /* SYS_LOCK_H */