Skip to content

Commit 3aab8c5

Browse files
author
mazhiyuan
committed
format thread_tc.c
1 parent c3465df commit 3aab8c5

File tree

1 file changed

+42
-41
lines changed

1 file changed

+42
-41
lines changed

examples/utest/testcases/kernel/thread_tc.c

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ ALIGN(RT_ALIGN_SIZE)
2020
static char thread2_stack[1024];
2121
static struct rt_thread thread2;
2222
#ifdef RT_USING_HEAP
23-
static rt_thread_t tid1 = RT_NULL;
24-
static rt_thread_t tid3 = RT_NULL;
25-
static rt_thread_t tid4 = RT_NULL;
26-
static rt_thread_t tid5 = RT_NULL;
27-
static rt_thread_t tid6 = RT_NULL;
28-
static rt_thread_t tid7 = RT_NULL;
23+
static rt_thread_t tid1 = RT_NULL;
24+
static rt_thread_t tid3 = RT_NULL;
25+
static rt_thread_t tid4 = RT_NULL;
26+
static rt_thread_t tid5 = RT_NULL;
27+
static rt_thread_t tid6 = RT_NULL;
28+
static rt_thread_t tid7 = RT_NULL;
2929
#endif /* RT_USING_HEAP */
3030

3131
static rt_uint32_t tid3_delay_pass_flag = 0;
@@ -35,16 +35,16 @@ static rt_uint32_t tid6_finish_flag = 0;
3535
static rt_uint32_t thread5_source = 0;
3636

3737
#ifndef RT_USING_SMP
38-
static rt_uint32_t thread_yield_flag = 0;
38+
static rt_uint32_t thread_yield_flag = 0;
3939
#endif
4040
static rt_uint32_t entry_idle_hook_times = 0;
4141
static rt_thread_t __current_thread;
4242
static rt_uint8_t change_priority;
4343
static rt_uint32_t count = 0;
4444

45-
void thread1_entry(void* param)
45+
void thread1_entry(void *param)
4646
{
47-
while(1);
47+
while (1);
4848
}
4949

5050
static void test_dynamic_thread(void)
@@ -53,22 +53,22 @@ static void test_dynamic_thread(void)
5353
rt_err_t ret_delete = -RT_ERROR;
5454

5555
tid1 = rt_thread_create("thread1",
56-
thread1_entry,
57-
(void*)1,
56+
thread1_entry,
57+
(void *)1,
5858
THREAD_STACK_SIZE,
59-
__current_thread->current_priority + 1,
59+
__current_thread->current_priority + 1,
6060
THREAD_TIMESLICE - 5);
6161
if (tid1 == RT_NULL)
6262
{
6363
uassert_false(tid1 == RT_NULL);
64-
goto __exit;
64+
goto __exit;
6565
}
6666

6767
ret_startup = rt_thread_startup(tid1);
68-
if(ret_startup != RT_EOK)
68+
if (ret_startup != RT_EOK)
6969
{
70-
uassert_false(ret_startup != RT_EOK);
71-
goto __exit;
70+
uassert_false(ret_startup != RT_EOK);
71+
goto __exit;
7272
}
7373

7474
ret_delete = rt_thread_delete(tid1);
@@ -88,9 +88,9 @@ static void test_dynamic_thread(void)
8888
return;
8989
}
9090

91-
void thread2_entry(void* param)
91+
void thread2_entry(void *param)
9292
{
93-
while(1);
93+
while (1);
9494
}
9595

9696
static void test_static_thread(void)
@@ -100,13 +100,13 @@ static void test_static_thread(void)
100100
rt_err_t ret_detach = - RT_ERROR;
101101

102102
ret_init = rt_thread_init(&thread2,
103-
"thread2",
104-
thread2_entry,
105-
(void*)2,
106-
&thread2_stack[0],
107-
sizeof(thread2_stack),
108-
__current_thread->current_priority + 1,
109-
THREAD_TIMESLICE);
103+
"thread2",
104+
thread2_entry,
105+
(void *)2,
106+
&thread2_stack[0],
107+
sizeof(thread2_stack),
108+
__current_thread->current_priority + 1,
109+
THREAD_TIMESLICE);
110110
if (ret_init != RT_EOK)
111111
{
112112
uassert_false(ret_init != RT_EOK);
@@ -168,15 +168,15 @@ static void test_thread_delay(void)
168168
uassert_false(tid3 == RT_NULL);
169169
goto __exit;
170170
}
171-
171+
172172
ret_startup = rt_thread_startup(tid3);
173173
if (ret_startup != RT_EOK)
174174
{
175175
LOG_E("rt_thread_startup failed!");
176176
uassert_false(1);
177177
goto __exit;
178178
}
179-
179+
180180
while (tid3_finish_flag != 1);
181181
uassert_true(tid3_delay_pass_flag == 1);
182182

@@ -374,7 +374,7 @@ static void test_thread_priority(void)
374374
{
375375
rt_err_t ret_startup = -RT_ERROR;
376376
rt_thread_t tid8 = RT_NULL;
377-
377+
378378
tid8 = rt_thread_create("thread8",
379379
thread8_entry,
380380
RT_NULL,
@@ -389,9 +389,9 @@ static void test_thread_priority(void)
389389
}
390390
count = 0;
391391
ret_startup = rt_thread_startup(tid8);
392-
if(ret_startup != RT_EOK)
392+
if (ret_startup != RT_EOK)
393393
{
394-
uassert_false(ret_startup != RT_EOK);
394+
uassert_false(ret_startup != RT_EOK);
395395
return ;
396396
}
397397
uassert_true(count == 10);
@@ -458,7 +458,7 @@ static void test_delay_until(void)
458458
#ifndef RT_USING_SMP
459459
static volatile rt_uint32_t yield_count;
460460

461-
static void test_thread_yield_inc_entry(void* parameter)
461+
static void test_thread_yield_inc_entry(void *parameter)
462462
{
463463
rt_uint32_t loop = 0;
464464

@@ -471,7 +471,7 @@ static void test_thread_yield_inc_entry(void* parameter)
471471
}
472472
}
473473

474-
static void test_thread_yield_entry(void* parameter)
474+
static void test_thread_yield_entry(void *parameter)
475475
{
476476
rt_err_t ret_startup = -RT_ERROR;
477477

@@ -480,7 +480,7 @@ static void test_thread_yield_entry(void* parameter)
480480
rt_uint32_t count_before;
481481

482482
tid = rt_thread_create("inc", test_thread_yield_inc_entry, RT_NULL,
483-
2048, 1, 10);
483+
2048, 1, 10);
484484
if (!tid)
485485
{
486486
LOG_E("rt_thread_create failed!");
@@ -520,7 +520,7 @@ void test_thread_yield_nosmp(void)
520520
yield_count = 0;
521521

522522
tid = rt_thread_create("chkcnt", test_thread_yield_entry, RT_NULL,
523-
2048, 1, 10);
523+
2048, 1, 10);
524524
if (!tid)
525525
{
526526
LOG_E("rt_thread_create failed!");
@@ -541,22 +541,23 @@ void test_thread_yield_nosmp(void)
541541
static rt_uint32_t thread9_count = 0;
542542
static void thread9_entry(void *parameter)
543543
{
544-
while(1)
544+
while (1)
545545
{
546546
thread9_count ++;
547547
}
548548

549549
}
550-
static void test_thread_suspend(void){
550+
static void test_thread_suspend(void)
551+
{
551552
static rt_thread_t tid;
552553
rt_err_t ret_startup = -RT_ERROR;
553554
uint32_t count_before_suspend, count_before_resume, count_after_resume;
554555
tid = rt_thread_create("thread9",
555-
thread9_entry,
556-
RT_NULL,
557-
THREAD_STACK_SIZE,
558-
__current_thread->current_priority + 1,
559-
THREAD_TIMESLICE);
556+
thread9_entry,
557+
RT_NULL,
558+
THREAD_STACK_SIZE,
559+
__current_thread->current_priority + 1,
560+
THREAD_TIMESLICE);
560561
if (tid == RT_NULL)
561562
{
562563
LOG_E("rt_thread_create failed!");

0 commit comments

Comments
 (0)