fb11e647
vrobic
reseau statique a...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*
* Copyright (C) 2013 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Thread test application
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
*
* @}
*/
#include <stdio.h>
#include "thread.h"
char second_thread_stack[THREAD_STACKSIZE_MAIN];
char third_thread_stack[THREAD_STACKSIZE_MAIN];
void *fourth_thread(void *arg)
{
(void) arg;
puts("4th: starting");
puts("4th: exiting");
return NULL;
}
void *third_thread(void *arg)
{
(void) arg;
puts("3rd: starting");
puts("3rd: exiting");
return NULL;
}
void *second_thread(void *arg)
{
(void) arg;
puts("2nd: starting");
if ((thread_create(
third_thread_stack,
sizeof(third_thread_stack),
THREAD_PRIORITY_MAIN - 2,
THREAD_CREATE_STACKTEST,
third_thread,
NULL,
"nr3")
) == -1) {
puts("2nd: Error creating 3rd thread.");
}
/* thread should have returned already */
if ((thread_create(
third_thread_stack,
sizeof(third_thread_stack),
THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
fourth_thread,
NULL,
"nr4")
) == -1) {
puts("2nd: Error creating 4th thread.");
}
puts("2nd: exiting");
return NULL;
}
int main(void)
{
puts("main: starting");
if ((thread_create(
second_thread_stack,
sizeof(second_thread_stack),
THREAD_PRIORITY_MAIN - 1,
THREAD_CREATE_WOUT_YIELD | THREAD_CREATE_STACKTEST,
second_thread,
NULL,
"nr2")
) == -1) {
puts("main: Error creating 2nd thread.");
}
puts("main: exiting");
return 0;
}
|