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

Function sys_channel_recv_timeout

components/lwp/lwp_syscall.c:4308–4323  ·  view source on GitHub ↗

* @brief Receives a message from a communication channel with a timeout. * * This system call attempts to receive a message from a specified communication channel identified * by the file descriptor `fd`. The received message is stored in the `data` buffer. If no message * is available within the specified timeout period, the function returns with a timeout status. * * @param[in] fd The

Source from the content-addressed store, hash-verified

4306 * message to avoid memory corruption or data loss.
4307 */
4308sysret_t sys_channel_recv_timeout(int fd, rt_channel_msg_t data, rt_int32_t time)
4309{
4310 rt_size_t ret = 0;
4311 rt_channel_msg_t kdata = RT_NULL;
4312
4313 kdata = kmem_get(sizeof(*data));
4314 if (kdata == RT_NULL)
4315 return -ENOMEM;
4316
4317 ret = lwp_channel_recv_timeout(FDT_TYPE_LWP, fd, kdata, time);
4318
4319 lwp_put_to_user(data, kdata, sizeof(*kdata));
4320 kmem_put(kdata);
4321
4322 return ret;
4323}
4324
4325static struct rt_semaphore critical_lock;
4326

Callers

nothing calls this directly

Calls 4

kmem_getFunction · 0.85
lwp_channel_recv_timeoutFunction · 0.85
lwp_put_to_userFunction · 0.85
kmem_putFunction · 0.85

Tested by

no test coverage detected