summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorShell <[email protected]>2024-05-08 09:25:57 +0800
committerGitHub <[email protected]>2024-05-08 09:25:57 +0800
commit48bd0e49f2687708e0aca2f3791ccc295920c80a (patch)
tree0136f4ea386c9b837ec07b436356bea30a00e0f2 /components/drivers/include
parent9ba6cec663428bad57204e2e3373b48c70efe61f (diff)
[ipc] support of lockless rt_completion (#8887)
* [ipc] lockless rt_completion implementation The new rt_completion implemented by lockless algorithm can improve timer resolution for up to ~12%, compare to sem IPC. Signed-off-by: Shell <[email protected]> * fixup: error * remove useless changes --------- Signed-off-by: Shell <[email protected]>
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/ipc/completion.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/components/drivers/include/ipc/completion.h b/components/drivers/include/ipc/completion.h
index 266ddd281e..30f4acf81c 100644
--- a/components/drivers/include/ipc/completion.h
+++ b/components/drivers/include/ipc/completion.h
@@ -5,6 +5,7 @@
*
* Change Logs:
* Date Author Notes
+ * 2024-04-28 Shell Add new wait_flags() & wakeup_by_errno() API
*/
#ifndef COMPLETION_H_
#define COMPLETION_H_
@@ -13,7 +14,7 @@
#include <rtconfig.h>
/**
- * Completion - A tiny IPC implementation for resource-constrained scenarios
+ * Completion - A tiny & rapid IPC primitive for resource-constrained scenarios
*
* It's an IPC using one CPU word with the encoding:
*
@@ -24,7 +25,7 @@
struct rt_completion
{
/* suspended thread, and completed flag */
- rt_base_t susp_thread_n_flag;
+ rt_atomic_t susp_thread_n_flag;
};
#define RT_COMPLETION_INIT(comp) {0}
@@ -32,7 +33,9 @@ struct rt_completion
void rt_completion_init(struct rt_completion *completion);
rt_err_t rt_completion_wait(struct rt_completion *completion,
rt_int32_t timeout);
+rt_err_t rt_completion_wait_flags(struct rt_completion *completion,
+ rt_int32_t timeout, int suspend_flag);
void rt_completion_done(struct rt_completion *completion);
rt_err_t rt_completion_wakeup(struct rt_completion *completion);
-
+rt_err_t rt_completion_wakeup_by_errno(struct rt_completion *completion, rt_err_t error);
#endif