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

Function rt_pipe_close

components/drivers/ipc/pipe.c:463–479  ·  view source on GitHub ↗

* @brief This function will close the pipe and release the pipe buffer. * * @param device is a pointer to the pipe device descriptor. * * @return Return the operation status. * When the return value is RT_EOK, the operation is successful. * When the return value is -RT_EINVAL, it means the device handle is empty. */

Source from the content-addressed store, hash-verified

461 * When the return value is -RT_EINVAL, it means the device handle is empty.
462 */
463rt_err_t rt_pipe_close(rt_device_t device)
464{
465 rt_pipe_t *pipe = (rt_pipe_t *)device;
466
467 if (device == RT_NULL)
468 {
469 return -RT_EINVAL;
470 }
471 rt_mutex_take(&pipe->lock, RT_WAITING_FOREVER);
472
473 rt_ringbuffer_destroy(pipe->fifo);
474 pipe->fifo = RT_NULL;
475
476 rt_mutex_release(&pipe->lock);
477
478 return RT_EOK;
479}
480
481/**
482 * @brief This function will read the specified length of data from the pipe.

Callers

nothing calls this directly

Calls 3

rt_mutex_takeFunction · 0.85
rt_ringbuffer_destroyFunction · 0.85
rt_mutex_releaseFunction · 0.85

Tested by

no test coverage detected