1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited
3  */
4 
5 #include "aos_cpp.h"
6 #include <stdio.h>
7 
8 using namespace AOS;
9 
10 Timer *pTimer_1;
11 
timer1_task(void * arg)12 static void timer1_task(void *arg)
13 {
14     static int count = 0;
15 
16     printf("timer1 count  %d\n", count++);
17 
18     if (count == 10) {
19         pTimer_1->stop();
20         pTimer_1->destory();
21     }
22 }
23 
test_timer(void)24 void test_timer(void)
25 {
26     pTimer_1 = new Timer;
27 
28     pTimer_1->create("timer1", (timer_cb_t)timer1_task, 1000, NULL);
29 
30     pTimer_1->start();
31 }
32