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 
9 #pragma once
10 
24 #ifndef DOXYGEN
25 
26 #include <stdint.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #if !defined(_RETARGETABLE_LOCKING)
33 
34 typedef void * _lock_t;
35 
36 #define _LOCK_T _lock_t
37 #define _LOCK_RECURSIVE_T _lock_t
38 
39 void _lock_init(_lock_t *lock);
40 void _lock_init_recursive(_lock_t *lock);
41 void _lock_close(_lock_t *lock);
42 void _lock_close_recursive(_lock_t *lock);
43 void _lock_acquire(_lock_t *lock);
44 void _lock_acquire_recursive(_lock_t *lock);
45 int _lock_try_acquire(_lock_t *lock);
46 int _lock_try_acquire_recursive(_lock_t *lock);
47 void _lock_release(_lock_t *lock);
48 void _lock_release_recursive(_lock_t *lock);
49 
50 #else /* !defined(_RETARGETABLE_LOCKING) */
51 
52 #include_next <sys/lock.h>
53 
54 #endif /* !defined(_RETARGETABLE_LOCKING) */
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* DOXYGEN */