summaryrefslogtreecommitdiff
path: root/src/thread.c
diff options
context:
space:
mode:
authorGabriel Wang <[email protected]>2022-01-07 23:35:44 +0000
committerGabriel Wang <[email protected]>2022-01-07 23:35:44 +0000
commitd7b8cf81e6285f3cbb0817cbe79c527f10ff56b7 (patch)
tree3e47ead2e339c0f1181c9ca2f4ffbfec9536d7eb /src/thread.c
parent495e209f379338b2bbc4ba086e457d0fb6d22a8d (diff)
move some __on_rt_xxxxx_hook from rtdef.h to dedicated c soure files
Diffstat (limited to 'src/thread.c')
-rw-r--r--src/thread.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/thread.c b/src/thread.c
index 090f5f1ef7..a024a3b7dc 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -28,13 +28,24 @@
* add support for tasks bound to cpu
* 2021-02-24 Meco Man rearrange rt_thread_control() - schedule the thread when close it
* 2021-11-15 THEWON Remove duplicate work between idle and _thread_exit
+ * 2022-01-07 Gabriel Moving __on_rt_xxxxx_hook to thread.c
*/
#include <rthw.h>
#include <rtthread.h>
#include <stddef.h>
-#ifdef RT_USING_HOOK
+#ifndef __on_rt_thread_inited_hook
+ #define __on_rt_thread_inited_hook(thread) __ON_HOOK_ARGS(rt_thread_inited_hook, (thread))
+#endif
+#ifndef __on_rt_thread_suspend_hook
+ #define __on_rt_thread_suspend_hook(thread) __ON_HOOK_ARGS(rt_thread_suspend_hook, (thread))
+#endif
+#ifndef __on_rt_thread_resume_hook
+ #define __on_rt_thread_resume_hook(thread) __ON_HOOK_ARGS(rt_thread_resume_hook, (thread))
+#endif
+
+#if defined(RT_USING_HOOK) && defined(RT_HOOK_USING_FUNC_PTR)
static void (*rt_thread_suspend_hook)(rt_thread_t thread);
static void (*rt_thread_resume_hook) (rt_thread_t thread);
static void (*rt_thread_inited_hook) (rt_thread_t thread);