mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 17:12:01 +08:00
[components/lwp]add doxygen comment for lwp futex. (#10763)
Some checks failed
ToolsCI / Tools (push) Has been cancelled
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
Some checks failed
ToolsCI / Tools (push) Has been cancelled
RT-Thread BSP Static Build Check / 🔍 Summary of Git Diff Changes (push) Has been cancelled
pkgs_test / change (push) Has been cancelled
utest_auto_run / A9 :components/dfs.cfg (push) Has been cancelled
utest_auto_run / A9 :components/lwip.cfg (push) Has been cancelled
utest_auto_run / A9 :components/netdev.cfg (push) Has been cancelled
utest_auto_run / A9 :cpp11/cpp11.cfg (push) Has been cancelled
utest_auto_run / AARCH64-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / A9-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / RISCV-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / XUANTIE-rtsmart :default.cfg (push) Has been cancelled
utest_auto_run / AARCH64 :default.cfg (push) Has been cancelled
utest_auto_run / A9 :default.cfg (push) Has been cancelled
utest_auto_run / A9-smp :default.cfg (push) Has been cancelled
utest_auto_run / RISCV :default.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / RISCV :kernel/atomic_c11.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/ipc.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/kernel_basic.cfg (push) Has been cancelled
utest_auto_run / A9 :kernel/mem.cfg (push) Has been cancelled
RT-Thread BSP Static Build Check / ${{ matrix.legs.RTT_BSP }} (push) Has been cancelled
RT-Thread BSP Static Build Check / collect-artifacts (push) Has been cancelled
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2025 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -25,25 +25,38 @@
|
||||
#include <lwp_user_mm.h>
|
||||
#endif /* ARCH_MM_MMU */
|
||||
|
||||
/**
|
||||
* @brief Shared futex key structure
|
||||
*
|
||||
* @note This structure represents a key used to identify shared futexes
|
||||
* in the system.
|
||||
*/
|
||||
struct shared_futex_key
|
||||
{
|
||||
rt_mem_obj_t mobj;
|
||||
rt_base_t offset;
|
||||
rt_mem_obj_t mobj; /**< Memory object associated with the futex */
|
||||
rt_base_t offset; /**< Offset within the memory object */
|
||||
};
|
||||
DEFINE_RT_UTHASH_TYPE(shared_futex_entry, struct shared_futex_key, key);
|
||||
|
||||
/**
|
||||
* @brief Futex structure for thread synchronization
|
||||
*
|
||||
* @note This structure represents a futex used for thread synchronization.
|
||||
* It can be either private (process-local) or shared between processes.
|
||||
*/
|
||||
struct rt_futex
|
||||
{
|
||||
union {
|
||||
union
|
||||
{
|
||||
/* for private futex */
|
||||
struct lwp_avl_struct node;
|
||||
struct lwp_avl_struct node; /**< AVL tree node for private futex */
|
||||
/* for shared futex */
|
||||
struct shared_futex_entry entry;
|
||||
struct shared_futex_entry entry; /**< Entry for shared futex */
|
||||
};
|
||||
|
||||
rt_list_t waiting_thread;
|
||||
struct rt_object *custom_obj;
|
||||
rt_mutex_t mutex;
|
||||
rt_list_t waiting_thread; /**< List of threads waiting on the futex */
|
||||
struct rt_object *custom_obj; /**< Custom object associated with the futex */
|
||||
rt_mutex_t mutex; /**< kernel mutex object for futex */
|
||||
};
|
||||
typedef struct rt_futex *rt_futex_t;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
* Copyright (c) 2006-2025 RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -12,6 +12,14 @@
|
||||
|
||||
static struct shared_futex_entry *_futex_hash_head;
|
||||
|
||||
/**
|
||||
* @brief Add a futex to the global hash table
|
||||
*
|
||||
* @param[in] key Pointer to the shared futex key structure
|
||||
* @param[in] futex The futex to be added to the table
|
||||
*
|
||||
* @return rt_err_t Returns RT_EOK on success, error code on failure
|
||||
*/
|
||||
rt_err_t futex_global_table_add(struct shared_futex_key *key, rt_futex_t futex)
|
||||
{
|
||||
rt_err_t rc = 0;
|
||||
@@ -23,6 +31,14 @@ rt_err_t futex_global_table_add(struct shared_futex_key *key, rt_futex_t futex)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find a futex in the global hash table
|
||||
*
|
||||
* @param[in] key Pointer to the shared futex key structure
|
||||
* @param[out] futex Pointer to store the found futex
|
||||
*
|
||||
* @return rt_err_t Returns RT_EOK if found, -RT_ENOENT if not found
|
||||
*/
|
||||
rt_err_t futex_global_table_find(struct shared_futex_key *key, rt_futex_t *futex)
|
||||
{
|
||||
rt_err_t rc;
|
||||
@@ -45,6 +61,13 @@ rt_err_t futex_global_table_find(struct shared_futex_key *key, rt_futex_t *futex
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete a futex from the global hash table
|
||||
*
|
||||
* @param[in] key Pointer to the shared futex key structure
|
||||
*
|
||||
* @return rt_err_t Returns RT_EOK if deleted successfully, -RT_ENOENT if not found
|
||||
*/
|
||||
rt_err_t futex_global_table_delete(struct shared_futex_key *key)
|
||||
{
|
||||
rt_err_t rc;
|
||||
|
||||
Reference in New Issue
Block a user