MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _futex_lock

Function _futex_lock

components/lwp/lwp_futex.c:43–59  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

41 * (when FUTEX_PRIVATE flag is set) or global futex locking mechanism.
42 */
43static 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

Callers 6

_sftx_getFunction · 0.85
_futex_waitFunction · 0.85
_futex_wakeFunction · 0.85
_futex_lock_piFunction · 0.85
_futex_unlock_piFunction · 0.85
lwp_futexFunction · 0.85

Calls 1

lwp_mutex_take_safeFunction · 0.85

Tested by

no test coverage detected