summaryrefslogtreecommitdiff
path: root/src/clock.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-11-22 22:44:46 +0800
committerGitHub <[email protected]>2018-11-22 22:44:46 +0800
commit6445328accc3570cb4b5d1394765074a29f4385d (patch)
tree9806ccc0627c400a3fab8dcc3b5d8f6e2490268d /src/clock.c
parent8cc81af1f651e275b7d812399eafe4bfb4e047e1 (diff)
parent94a2e751a57938c43cba54b5eb1ac00fd3716ed4 (diff)
Merge pull request #1999 from jesven/smp_4.0
Smp 4.0
Diffstat (limited to 'src/clock.c')
-rw-r--r--src/clock.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/clock.c b/src/clock.c
index 651465e0a8..1bedb4e06a 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -12,12 +12,17 @@
* 2010-05-20 Bernard fix the tick exceeds the maximum limits
* 2010-07-13 Bernard fix rt_tick_from_millisecond issue found by kuronca
* 2011-06-26 Bernard add rt_tick_set function.
+ * 2018-11-22 Jesven add per cpu tick
*/
#include <rthw.h>
#include <rtthread.h>
+#ifdef RT_USING_SMP
+#define rt_tick rt_cpu_index(0)->tick
+#else
static rt_tick_t rt_tick = 0;
+#endif
extern void rt_timer_check(void);
@@ -71,7 +76,11 @@ void rt_tick_increase(void)
struct rt_thread *thread;
/* increase the global tick */
+#ifdef RT_USING_SMP
+ rt_cpu_self()->tick ++;
+#else
++ rt_tick;
+#endif
/* check time slice */
thread = rt_thread_self();