[riot-notifications] [RIOT-OS/RIOT] core/thread.c: thread_create fix priority type (#12203)

Martine Lenders notifications at github.com
Wed Sep 11 20:55:17 CEST 2019


miri64 approved this pull request.

Seconded I tested by modifying `tests/thread_flood`:

```diff
diff --git a/tests/thread_flood/Makefile b/tests/thread_flood/Makefile
index 18b41ca54..96d3ca4bf 100644
--- a/tests/thread_flood/Makefile
+++ b/tests/thread_flood/Makefile
@@ -1,5 +1,6 @@
 include ../Makefile.tests_common
 
 DISABLE_MODULE += auto_init
+USEMODULE += ps
 
 include $(RIOTBASE)/Makefile.include
diff --git a/tests/thread_flood/main.c b/tests/thread_flood/main.c
index bfc58d1c5..595392187 100644
--- a/tests/thread_flood/main.c
+++ b/tests/thread_flood/main.c
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <stdio.h>
 
+#include "ps.h"
 #include "thread.h"
 #include "kernel_types.h"
 
@@ -44,7 +45,7 @@ int main(void)
     do {
         thr_id = thread_create(
             dummy_stack, sizeof(dummy_stack),
-            THREAD_PRIORITY_MAIN - 1,
+            -(THREAD_PRIORITY_MAIN - 1),
             THREAD_CREATE_SLEEPING | THREAD_CREATE_STACKTEST,
             thread_func, NULL, "dummy");
             ++thr_cnt;
@@ -62,6 +63,7 @@ int main(void)
         printf("[ERROR] expected %u,", (MAXTHREADS - 2));
     }
     printf(" created %u\n", thr_cnt);
+    ps();
 
     return 0;
 }
```
On master I can compile and get with `native`

```
RIOT native interrupts/signals initialized.
LED_RED_OFF
LED_GREEN_ON
RIOT native board initialized.
RIOT native hardware initialization complete.

main(): This is RIOT! (Version: 2019.10-devel-778-g729ba)
[START] Spawning threads
...............................
[SUCCESS] created 30
	pid | name                 | state    Q | pri | stack  ( used) | base addr  | current     
	  - | isr_stack            | -        - |   - |   8192 (   -1) | 0x56629400 | 0x56629400
	  1 | idle                 | pending  Q |  15 |   8192 (  436) | 0x56627120 | 0x56628f80 
	  2 | main                 | running  Q |   7 |  12288 ( 2716) | 0x56624120 | 0x56626f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	 32 | dummy                | sleeping _ | 250 |   8192 (   52) | 0x56622120 | 0x56623f80 
	    | SUM                  |            |     | 274432 ( 4712)
^C
```

With this PR the test falls into an endless loop and never stops printing dots (as `thr_id` will always be `-EINVAL`).



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12203#pullrequestreview-287003171
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190911/93950726/attachment.htm>


More information about the notifications mailing list