1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 05:53:49 +01:00

659 Commits

Author SHA1 Message Date
crasbe
d732bd053d
Merge pull request #21254 from derMihai/mir/tflags_group
core/thread_flags: add thread flags group
2025-07-10 11:48:29 +00:00
Mihai Renea
eb3c8c3f3f core/thread_flags: add thread flags group 2025-05-28 21:02:27 +02:00
chrysn
79071b10f2 core/doc: Thread names are expected to be long-lived 2025-05-19 15:55:05 +02:00
Marian Buschsieweke
16c24a43e9
Merge pull request #21414 from maribu/core/thread/thread_msg_has_queue
core/thread: fix thread_has_msg_queue()
2025-04-17 20:41:30 +00:00
Marian Buschsieweke
87ff0d550d
core/thread_get_unchecked(): fix doc
This fixes the API doc for thread_get_unchecked()
2025-04-17 18:49:49 +02:00
Marian Buschsieweke
2a65b9cfa5
core/thread: fix thread_has_msg_queue()
This fixes compilation with `-fanalyzer`. We use `assume()` to signal
GCC that `thread` must not be null in `NDEBUG` mode, and `assert()` it
in with enabled assertions.

This also drops the `volatile` qualifier from the function argument and
changes the return value to `bool`.
2025-04-17 18:47:39 +02:00
Marian Buschsieweke
d36465d532
core/msg: handle error in msg_queue_capacity()
Rather than using an `assert()` on `thread_get()`, check for the thread
to exist and return a capacity of `0` if it does not.

This fixes compilation with `-fanalyzer` with `NDEBUG` defined, is more
consistent with other core APIs, and makes the API usable for threads
with a dynamic life cycle.

Co-authored-by: crasbe <crasbe@gmail.com>
2025-04-17 07:55:13 +02:00
Marian Buschsieweke
55f9d1c930
Merge pull request #21405 from JerelJr/fix-core-headers
core: replace header guards with #pragma once
2025-04-16 05:30:21 +00:00
JerelJr
04dafd5618 core: replace header guards with #pragma once
core/lib/include/ringbuffer.h: removed trailing newline

core/lib/include/irq.h: restored header guard for irq.h to resolve build errors

core/lib/include/irq.h: added trailing newline to irq.h
2025-04-15 14:55:38 -04:00
Marian Buschsieweke
caa5561667
core/msg: fix msg_avail_thread() and msg_avail()
This now ensures race-free access to the CIB tracking the number
of messages queued in the ringbuffer for a given thread.

In addition, `msg_avail_thread()` now checks if the provided pid refers
to a thread that is currently existing.

Co-authored-by: Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
2025-04-15 15:07:11 +02:00
benpicco
85dc9be1c9
Merge pull request #20872 from benpicco/stdio_null-frontend
core: add stdio.h to replace stdout functions with stdio_null
2025-04-01 15:30:08 +00:00
Benjamin Valentin
35005c3e85 core: add stdio.h to replace stdout functions with stdio_null 2025-04-01 14:29:28 +02:00
Karl Fessel
1446aeab24 core/mutex: separate documentation 2025-04-01 11:30:15 +02:00
Marian Buschsieweke
785faa77f7
Merge pull request #21253 from DeJusten/2025-02.thread
core/thread: error in thread.c corrected
2025-03-14 12:26:57 +00:00
DeJusten
3cbde6a2ee
core/thread: thread_create(): improve error handling
Return `-EINVAL` when stack is too small in addition to warn when
`ENABLE_DEBUG` is set.
2025-03-14 11:03:58 +01:00
Mikolai Gütschow
850a827c24
core/msg: re-enable IRQs before printing for highlevel_stdio
copy message queue information to stack before
2024-11-28 12:49:11 +01:00
Benjamin Valentin
46ecf82e24 core/mutex: add mutex_init_locked() 2024-11-06 12:53:17 +01:00
Benjamin Valentin
97128eef48 treewide: clean up remnants of THREAD_CREATE_STACKTEST 2024-10-07 17:31:31 +02:00
Benjamin Valentin
0fbc10fb45 core/thread: introduce THREAD_CREATE_NO_STACKTEST 2024-07-29 11:45:58 +02:00
Benjamin Valentin
b1d3825c27 core/thread: always use THREAD_CREATE_STACKTEST with DEVELHELP 2024-07-29 11:45:58 +02:00
Marian Buschsieweke
70f5747712
core/native_shed: Fix compilation with musl
On musl, `spu_set_t` is provided by system headers, so only provide
that with glibc.
2024-06-05 21:57:43 +02:00
Marian Buschsieweke
e93b5e4b98
core/thread: fix thread_measure_stack_free()
`thread_measure_stack_free()` previously assumed that reading past the
stack is safe. When the stack was indeed part of a thread, the
`thread_t` structure is put after the stack, increasing the odds of
this assumption to hold. However, `thread_measure_stack_free()` could
also be used on the ISR stack, which may be allocated at the end of
SRAM.

A second parameter had to be added to indicate the stack size, so that
reading past the stack can now be prevented.

This also makes valgrind happy on `native`/`native64`.
2024-05-31 19:54:10 +02:00
Marian Buschsieweke
cf6fa4edf0
tree wide: add IWYU pragma: export where needed
We occasionally have some public `foo.h` header that includes a private
`foo_arch.h` header. Users are expected to include the `foo.h` header
and not the `foo_arch.h`. However, clangd will claim that the `#include`
of `foo.h` is unused if only functions / macros/ types / ... from
`foor_arch.h` is used and nothing from `foo.h`.

This adds the `IWYU pragma: export` comment to the include of
`foo_arch.h` in `foo.h`, so that clangd treats functions / macros /
types provided by `foo_arch.h` as if they were instead provided by
`foo.h`, which fixes the false positives.
2024-04-14 14:26:05 +02:00
Martine Lenders
12194ad9e6
mbox: provide function to unset initialized mbox 2024-03-19 12:27:33 +01:00
Frederik Haxel
0c2cfe99e6 native64: Add Linux/x86_64 board
Adds a separate board for native64 instead of the `NATIVE_64BIT` workaround.
The files in `boards/native64` are more or less dummy files and just include
the `boards/native` logic (similar to `openlabs-kw41z-mini-256kib`).
The main logic for native is in `makefiles/arch/native.inc.mk`, `cpu/native`
and `boards/native`.

The remaining changes concern the build system, and change native board checks
to native CPU checks to cover both boards.
2024-02-05 22:01:40 +01:00
bors[bot]
910e0e28ed
Merge #19963 #19971 #19974 #19975 #19976
19963: sys/event/timeout: add event_timeout_is_pending() r=benpicco a=benpicco



19971: sys/shell/gnrc_netif: Fix a few blockers for sharing ifconfig shell r=benpicco a=yarrick



19974: gnrc_ipv6_ext_frag: _completed: Add comment why list head is not checked for NULL pointer dereference r=benpicco a=miri64

 


19975: pkg/nanocbor: Bump to latest commit r=benpicco a=bergzand

### Contribution description

Not much to see here

Important changes:
- Add stream-like interface for encoder
- Separate functions for number of items left in arrays and maps

### Testing procedure

The usual test should still work

### Issues/PRs references

None

19976: core: Express -1 as ~0 in thread_status_t cast r=benpicco a=SimonIT



Co-authored-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Co-authored-by: Erik Ekman <eekman@google.com>
Co-authored-by: Martine Lenders <m.lenders@fu-berlin.de>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: SimonIT <simonit.orig@gmail.com>
2023-10-16 15:31:25 +00:00
Marian Buschsieweke
edc43201db
tree-wide: fix typos in doc and comments
This should not change any generated binary
2023-10-16 12:17:48 +02:00
SimonIT
d778e2eb5f
core: Express -1 as ~0 in thread_status_t cast 2023-10-15 23:54:16 +02:00
Marian Buschsieweke
aed175b14b
core/thread: drop unused thread_arch_t
No architecture makes use of thread_arch_t anymore, so let's drop it.
2023-05-21 22:17:52 +02:00
5d2948c5fe core: move macros/math.h to core/lib/include/macros 2023-05-02 14:02:15 +02:00
Marian Buschsieweke
3e86e39646
core: add core_mutex_debug to aid debugging deadlocks
Adding `USEMODULE += core_mutex_debug` to your `Makefile` results in
on log messages such as

    [mutex] waiting for thread 1 (pc = 0x800024d)

being added whenever `mutex_lock()` blocks. This makes tracing down
deadlocks easier.
2023-04-25 15:10:34 +02:00
Karl Fessel
aa31dd7d66 core/macros: rewrite DIV_ROUND, DIV_ROUND_UP; add DIV_ROUND_INF 2022-11-09 17:59:18 +01:00
Benjamin Valentin
8f8bb6ce84 tests/unittests: core: add test for SIGNOF(size_t) 2022-11-09 14:23:51 +01:00
Benjamin Valentin
1eb02f7fda core/macros: fix SIGNOF() macro with size_t 2022-11-04 23:53:15 +01:00
Marian Buschsieweke
2d2bb4b308
core/mutex: clean up
This restores a pre-existing design decision to implement both
blocking and non-blocking mutex locking with the same code. Those
implementations have been split prior to the introduction of
the `core_mutex_priority_inheritance` module when `mutex_trylock()`
indeed was trivial. This decision didn't age well, so undo it.
2022-09-29 13:12:33 +02:00
benpicco
4737d8148a
Merge pull request #17702 from benpicco/core/macros/math
core/macros: add math helper macros
2022-09-22 14:14:24 +02:00
Benjamin Valentin
c53051f72f core/macros: add math helper macros 2022-09-21 16:00:26 +02:00
Gregory Holder
4d4c595185
core/mutex: fix typo in docs 2022-09-16 14:52:13 +02:00
Marian Buschsieweke
8be03dc055
core: implement core_mutex_mitigate_priority_inversion 2022-08-05 13:08:52 +02:00
Benjamin Valentin
8100203e95 core/thread, mutex: provide dummy implementation for riotboot
This is intended for the bootloader module where we don't enter thread
mode, so mutex must never attempt to switch context.

Instead use a simple busy wait that is enough to make the possible mutex
users (e.g. interrupt based SPI) in bootloader mode work.
2022-05-02 13:18:39 +02:00
2ba85c1bc8 core: add support for test_utils_print_stack_usage
- activate THREAD_CREATE_STACKTEST also if test_utils_print_stack_usage
  is used

- make thread_measure_stack_free() available unconditionally

- if DEVELHELP is active, call test_utils_print_stack_usage() on any
  thread exit

- if DEVELHELP is active, call test_utils_print_stack_usage() after main
  for the idle thread, if that is used
2022-03-29 21:49:35 +02:00
3db7c1150a core: split out library code
This commit splits core into it's scheduler/IPC part and into other code
that is either used or uses the scheduler, through defined APIs.
2022-03-09 21:43:05 +01:00
Martine Lenders
bb89334322
core: add functionality to check queue state of another thread 2022-03-03 16:50:34 +01:00
7c0ddbd1d8
Merge pull request #17472 from chrysn-pull-requests/doc-flags-msgs
core (largely doc): Differentiate message types from thread flags
2022-02-27 21:10:47 +01:00
chrysn
b923fec952 core/thread: Add constant value to check custom flags against
Co-authored-by: benpicco <benpicco@googlemail.com>
2022-02-26 22:17:33 +01:00
chrysn
4bbe0ec42d core/msg doc: No need for system-wide uniqueness 2022-02-26 22:08:31 +01:00
Benjamin Valentin
1bf151f01f core/init: declare board_init() 2022-02-25 15:08:58 +01:00
Karl Fessel
726c461cb5
Merge pull request #17574 from kfessel/p-fix-asserth
core/assert: avoid including panic.h with assert.h
2022-02-15 11:57:55 +01:00
Karl Fessel
ca112c224a core/assert.h: doxygen brief for __NORETURN 2022-02-15 10:34:54 +01:00
Karl Fessel
0b52b3e62e core/assert: remove panic include from assert.h 2022-02-12 18:30:58 +01:00