* @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 */
| 40 | * @return rt_err_t Returns RT_EOK if found, -RT_ENOENT if not found |
| 41 | */ |
| 42 | rt_err_t futex_global_table_find(struct shared_futex_key *key, rt_futex_t *futex) |
| 43 | { |
| 44 | rt_err_t rc; |
| 45 | rt_futex_t found_futex; |
| 46 | struct shared_futex_entry *entry; |
| 47 | |
| 48 | RT_UTHASH_FIND(_futex_hash_head, key, sizeof(struct shared_futex_key), entry); |
| 49 | if (entry) |
| 50 | { |
| 51 | rc = RT_EOK; |
| 52 | found_futex = rt_container_of(entry, struct rt_futex, entry); |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | rc = -RT_ENOENT; |
| 57 | found_futex = RT_NULL; |
| 58 | } |
| 59 | |
| 60 | *futex = found_futex; |
| 61 | return rc; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @brief Delete a futex from the global hash table |