* @brief Destroy a Shared FuTeX (sftx) * * @param[in] data Pointer to the futex to be destroyed (cast from void* to rt_futex_t) * * @return RT_EOK (0) on success, -1 on failure * * @note This function: * - Deletes the futex from global table. * - Deletes and nullifies the futex mutex. * - Frees the futex memory. */
| 264 | * - Frees the futex memory. |
| 265 | */ |
| 266 | static rt_err_t _sftx_destroy(void *data) |
| 267 | { |
| 268 | rt_err_t ret = -1; |
| 269 | rt_futex_t futex = (rt_futex_t)data; |
| 270 | |
| 271 | if (futex) |
| 272 | { |
| 273 | /* delete it even it's not in the table */ |
| 274 | futex_global_table_delete(&futex->entry.key); |
| 275 | if (futex->mutex) |
| 276 | { |
| 277 | rt_mutex_delete(futex->mutex); |
| 278 | futex->mutex = RT_NULL; |
| 279 | } |
| 280 | rt_free(futex); |
| 281 | ret = 0; |
| 282 | } |
| 283 | return ret; |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * @brief Create a Shared FuTeX (sftx) |
nothing calls this directly
no test coverage detected