lock.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef __SYS_LOCK_H__
  7. #define __SYS_LOCK_H__
  8. #include <sys/types.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /* newlib locks implementation for CONFIG_IDF_TARGET_LINUX, single threaded.
  13. * Note, currently this doesn't implement the functions required
  14. * when _RETARGETABLE_LOCKING is defined. They should be added.
  15. */
  16. /* Compatibility definitions for legacy newlib locking functions */
  17. typedef int _lock_t;
  18. static inline void _lock_init(_lock_t *plock) {}
  19. static inline void _lock_init_recursive(_lock_t *plock) {}
  20. static inline void _lock_close(_lock_t *plock) {}
  21. static inline void _lock_close_recursive(_lock_t *plock) {}
  22. static inline void _lock_acquire(_lock_t *plock) {}
  23. static inline void _lock_acquire_recursive(_lock_t *plock) {}
  24. static inline int _lock_try_acquire(_lock_t *plock)
  25. {
  26. return 1;
  27. }
  28. static inline int _lock_try_acquire_recursive(_lock_t *plock)
  29. {
  30. return 1;
  31. }
  32. static inline void _lock_release(_lock_t *plock) {}
  33. static inline void _lock_release_recursive(_lock_t *plock) {}
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* __SYS_LOCK_H__ */