diff options
| author | zhkag <[email protected]> | 2023-06-21 10:22:42 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-21 18:22:42 +0800 |
| commit | 33f550cb65c950068ff04c331daeeda3547d2e50 (patch) | |
| tree | d04ca979398cfaa280cd9f19e400a40943f96bde /documentation/thread-comm/thread-comm.md | |
| parent | b4e59bac4e2d8b039a2365ddc219ac9a3caf0f77 (diff) | |
[Kernel] message 可以返回消息的实际大小 (#7709)
Diffstat (limited to 'documentation/thread-comm/thread-comm.md')
| -rw-r--r-- | documentation/thread-comm/thread-comm.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/documentation/thread-comm/thread-comm.md b/documentation/thread-comm/thread-comm.md index 4369752855..758c8defa5 100644 --- a/documentation/thread-comm/thread-comm.md +++ b/documentation/thread-comm/thread-comm.md @@ -595,7 +595,7 @@ static void thread1_entry(void *parameter) while (1) { /* Receive messages from the message queue */ - if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) == RT_EOK) + if (rt_mq_recv(&mq, &buf, sizeof(buf), RT_WAITING_FOREVER) >= 0) { rt_kprintf("thread1: recv msg from msg queue, the content:%c\n", buf); if (cnt == 19) @@ -784,7 +784,7 @@ void message_handler() struct msg msg_ptr; /* Local variable used to place the message */ /* Receive messages from the message queue into msg_ptr */ - if (rt_mq_recv(mq, (void*)&msg_ptr, sizeof(struct msg)) == RT_EOK) + if (rt_mq_recv(mq, (void*)&msg_ptr, sizeof(struct msg)) >= 0) { /* Successfully received the message, corresponding data processing is performed */ } |
