123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #pragma once
- #if defined(PLATFORM_SUPPORTS_SYNCHRONIZATION)
- # if defined(SPLIT_KEYBOARD)
- void split_shared_memory_lock(void);
- void split_shared_memory_unlock(void);
- # endif
- #else
- # if defined(SPLIT_KEYBOARD)
- inline void split_shared_memory_lock(void){};
- inline void split_shared_memory_unlock(void){};
- # endif
- #endif
- #define QMK_DECLARE_AUTOUNLOCK_HELPERS(prefix) \
- inline unsigned prefix##_autounlock_lock_helper(void) { \
- prefix##_lock(); \
- return 0; \
- } \
- \
- inline void prefix##_autounlock_unlock_helper(unsigned* unused_guard) { \
- prefix##_unlock(); \
- }
- #define QMK_DECLARE_AUTOUNLOCK_CALL(prefix) unsigned prefix##_guard __attribute__((unused, cleanup(prefix##_autounlock_unlock_helper))) = prefix##_autounlock_lock_helper
- #if defined(SPLIT_KEYBOARD)
- QMK_DECLARE_AUTOUNLOCK_HELPERS(split_shared_memory)
- # define split_shared_memory_lock_autounlock QMK_DECLARE_AUTOUNLOCK_CALL(split_shared_memory)
- #endif
|