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

Function _sftx_destroy

components/lwp/lwp_futex.c:266–284  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

264 * - Frees the futex memory.
265 */
266static 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)

Callers

nothing calls this directly

Calls 3

rt_mutex_deleteFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected