source: trunk/libs/newlib/src/newlib/libc/include/sys/lock.h @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.4 KB
Line 
1#ifndef __SYS_LOCK_H__
2#define __SYS_LOCK_H__
3
4/* dummy lock routines for single-threaded aps */
5
6#include <newlib.h>
7#include <_ansi.h>
8
9#if !defined(_RETARGETABLE_LOCKING)
10
11typedef int _LOCK_T;
12typedef int _LOCK_RECURSIVE_T;
13
14#define __LOCK_INIT(class,lock) static int lock = 0;
15#define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
16#define __lock_init(lock) ((void) 0)
17#define __lock_init_recursive(lock) ((void) 0)
18#define __lock_close(lock) ((void) 0)
19#define __lock_close_recursive(lock) ((void) 0)
20#define __lock_acquire(lock) ((void) 0)
21#define __lock_acquire_recursive(lock) ((void) 0)
22#define __lock_try_acquire(lock) ((void) 0)
23#define __lock_try_acquire_recursive(lock) ((void) 0)
24#define __lock_release(lock) ((void) 0)
25#define __lock_release_recursive(lock) ((void) 0)
26
27#else
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33struct __lock;
34typedef struct __lock * _LOCK_T;
35#define _LOCK_RECURSIVE_T _LOCK_T
36
37#define __LOCK_INIT(class,lock) extern struct __lock __lock_ ## lock; \
38        class _LOCK_T lock = &__lock_ ## lock
39#define __LOCK_INIT_RECURSIVE(class,lock) __LOCK_INIT(class,lock)
40
41extern void __retarget_lock_init(_LOCK_T *lock);
42#define __lock_init(lock) __retarget_lock_init(&lock)
43extern void __retarget_lock_init_recursive(_LOCK_T *lock);
44#define __lock_init_recursive(lock) __retarget_lock_init_recursive(&lock)
45extern void __retarget_lock_close(_LOCK_T lock);
46#define __lock_close(lock) __retarget_lock_close(lock)
47extern void __retarget_lock_close_recursive(_LOCK_T lock);
48#define __lock_close_recursive(lock) __retarget_lock_close_recursive(lock)
49extern void __retarget_lock_acquire(_LOCK_T lock);
50#define __lock_acquire(lock) __retarget_lock_acquire(lock)
51extern void __retarget_lock_acquire_recursive(_LOCK_T lock);
52#define __lock_acquire_recursive(lock) __retarget_lock_acquire_recursive(lock)
53extern int __retarget_lock_try_acquire(_LOCK_T lock);
54#define __lock_try_acquire(lock) __retarget_lock_try_acquire(lock)
55extern int __retarget_lock_try_acquire_recursive(_LOCK_T lock);
56#define __lock_try_acquire_recursive(lock) \
57  __retarget_lock_try_acquire_recursive(lock)
58extern void __retarget_lock_release(_LOCK_T lock);
59#define __lock_release(lock) __retarget_lock_release(lock)
60extern void __retarget_lock_release_recursive(_LOCK_T lock);
61#define __lock_release_recursive(lock) __retarget_lock_release_recursive(lock)
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* !defined(_RETARGETABLE_LOCKING) */
68
69#endif /* __SYS_LOCK_H__ */
Note: See TracBrowser for help on using the repository browser.