Quand j’essai ce code :
…
static void *thread_handlera(void *arg)
{
(void)arg;
puts(“Hello from threada”);
return NULL;
}
static void *thread_handlerb(void arg)
{
(void)arg;
puts(“Hello from threadb”);
return NULL;
}
…
int main(void) {
/ Start new threads here */
thread_create(stack,
sizeof(stack),
THREAD_PRIORITY_MAIN - 1,
0,
thread_handlera,
NULL,
“new threada”);
thread_create(stack,
sizeof(stack),
THREAD_PRIORITY_MAIN - 2,
0,
thread_handlerb,
NULL,
“new threadb”);
…}
J’obtiens :
main(): This is RIOT! (Version: 2020.01)
Hello from threada
Hello from threadb
Mais si :
pour threada : THREAD_PRIORITY_MAIN + 1,
pour threadb : THREAD_PRIORITY_MAIN + 2,
Alors :
ps
pid | name | state Q | pri | stack ( used) | base addr | current
- | isr_stack | - - | - | 8192 ( -1) | 0x56582380 | 0x56582380
1 | idle | pending Q | 15 | 8192 ( 420) | 0x565800a0 | 0x56581f10
2 | main | running Q | 7 | 12288 ( 3136) | 0x5657d0a0 | 0x5657ff10
4 | new threadb | pending Q | 9 | 12288 (12284) | 0x5657a0a0 | 0x5657cf10
4 | new threadb | pending Q | 9 | 12288 (12284) | 0x5657a0a0 | 0x5657cf10
| SUM | | | 53248 (28124)
où est mon threada ?
Merci de votre réponse, cordialement