summaryrefslogtreecommitdiff
path: root/src/osal/osal_rtthread.h
diff options
context:
space:
mode:
authorIngHK <[email protected]>2024-03-21 08:30:49 +0100
committerIngHK <[email protected]>2024-03-21 08:30:49 +0100
commit1bbd658352f5ecbfea13343df20cd02597dc31fd (patch)
treef4454789c81f52afed0433d2f448105c5a80ccd4 /src/osal/osal_rtthread.h
parentcb69ed0d0423b8e09ae77307fcc01165ae4c9386 (diff)
parent60764de56461edbf1e8bafe4e73fdc97ec3d2e6e (diff)
Merge remote-tracking branch 'remotes/hathach/master' into work
Diffstat (limited to 'src/osal/osal_rtthread.h')
-rw-r--r--src/osal/osal_rtthread.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/osal/osal_rtthread.h b/src/osal/osal_rtthread.h
index 18eb9c693..d03b53bee 100644
--- a/src/osal/osal_rtthread.h
+++ b/src/osal/osal_rtthread.h
@@ -2,6 +2,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2020 tfx2001 ([email protected])
+ * Copyright (c) 2020 yekai ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -111,9 +112,12 @@ TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_queue_de
}
TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t qhdl, void *data, uint32_t msec) {
-
rt_tick_t tick = rt_tick_from_millisecond((rt_int32_t) msec);
+#if RT_VERSION_MAJOR >= 5
+ return rt_mq_recv(qhdl, data, qhdl->msg_size, tick) > 0;
+#else
return rt_mq_recv(qhdl, data, qhdl->msg_size, tick) == RT_EOK;
+#endif /* RT_VERSION_MAJOR >= 5 */
}
TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qhdl, void const *data, bool in_isr) {