* @brief Locks the global futex with specified operation flags * * @param[in] lwp Pointer to the lightweight process structure * @param[in] op_flags Operation flags (e.g., FUTEX_PRIVATE) * * @note This function handles locking of futexes, either using process-local locking * (when FUTEX_PRIVATE flag is set) or global futex locking mechanism. */
| 41 | * (when FUTEX_PRIVATE flag is set) or global futex locking mechanism. |
| 42 | */ |
| 43 | static void _futex_lock(rt_lwp_t lwp, int op_flags) |
| 44 | { |
| 45 | rt_err_t error; |
| 46 | if (op_flags & FUTEX_PRIVATE) |
| 47 | { |
| 48 | LWP_LOCK(lwp); |
| 49 | } |
| 50 | else |
| 51 | { |
| 52 | error = lwp_mutex_take_safe(&_glob_futex, RT_WAITING_FOREVER, 0); |
| 53 | if (error) |
| 54 | { |
| 55 | LOG_E("%s: Should not failed", __func__); |
| 56 | RT_ASSERT(0); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @brief Unlocks the global futex with specified operation flags |
no test coverage detected