1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

119 Commits

Author SHA1 Message Date
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
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
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
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
chrysn
fef782f735 core/thread doc: Point to helper function 2022-01-20 14:18:40 +01:00
Martine Lenders
e27fd3018e
core/thread.h: fix new uncrustify error 2021-11-05 09:27:00 +01:00
Martine Lenders
f08989a3c8
core: make SCHED_TEST_STACK boolean and default to 1 with DEVELHELP 2021-11-05 09:27:00 +01:00
2b2c5fe746 core/thread: provide getters for thread_t fields as used by ps() 2021-09-15 10:16:45 +02:00
e8e8405c4a core/thread: move thread configuration into seperate header 2021-03-02 11:56:11 +01:00
9d5f87bf67
core/thread: Allow for inline thread_yield_higher
Similar to irq.h, this allows for inline the often trivial
thread_yield_higher function
2021-01-19 11:03:20 +01:00
f0ce992d4a
core/thread: uncrustify header file 2021-01-19 10:28:58 +01:00
ceea0ba949 core/thread: add thread_is_active() 2020-11-25 20:49:00 +01:00
017e9e9d4d core/thread: add thread_get_status() 2020-11-25 14:39:22 +01:00
5321bcde89 core: thread: move thread_state_to_string() from ps.c 2020-11-25 14:35:00 +01:00
Marian Buschsieweke
e028f6bbe6
core/thread: thread_measure_stack_free() const arg
Add `const` to stack pointer passed to thread_measure_stack_free()
2020-09-25 14:30:33 +02:00
Jim O'Brien
bd149e7db9 thread: Add THREAD_NAMES make flag
Separate thread names from DEVELHELP so thread names can be
enabled in non-development/debug builds when required/desired.
THREAD_NAMES will be enabled by default then DEVELHELP is set to 1.
2020-09-10 10:08:27 +02:00
Keith Packard
531050ada2 picolibc: Enable TLS support [v4]
Allocate and initialize a thread-local block for each thread at the
top of the stack.

Set the tls base when switching to a new thread.

Add tdata/tbss linker instructions to cortex_m and risc-v scripts.

Signed-off-by: Keith Packard <keithp@keithp.com>

---

v2:
	Squash fixes

v3:
	Replace tabs with spaces

v4:
	Add tbss to fe310 linker script
2020-08-24 08:26:16 -07:00
Marian Buschsieweke
4a31578982
core/thread: Add/change helper access functions
- Add `thread_get_active()` to access the TCB
- Add `thread_get_unchecked()` as fast alternative to `thread_get()`
- Drop `volatile` qualifier in `thread_get()`
    - Right now every caller of this function does this. It is better to
      contain this undefined behavior to at least one place in code
2020-08-06 14:35:43 +02:00
Marian Buschsieweke
315cdcdb5f
core/thread: Make thread_get inlineable 2020-08-05 10:51:16 +02:00
8efe5960aa core: uncrustify 2020-03-30 17:02:08 +02:00
JulianHolzwarth
2655c97fd5 core/thread.c: new function for zombie state 2019-12-11 16:48:31 +01:00
Francois Berder
4a31f94cfc many typo fixes
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
2019-11-23 22:39:07 +01:00
JulianHolzwarth
fbf6a665e1 core/thread.c: change thread_getstatus return type
thread_status_t instead of int
2019-10-15 15:55:05 +02:00
JulianHolzwarth
1d16b3d5dc core/thread.c: thread_create fix priority type
Bugfix: changing type of priority to uint8_t to be consistent with struct _thread
2019-09-11 17:42:48 +02:00
Martine Lenders
db20a057ae core: rename thread_state_t to thread_status_t
This way it can't come to name collisions on `native` with Mac OSX'
threading library [1].

[1]: https://opensource.apple.com/source/xnu/xnu-792/osfmk/mach/thread_status.h.auto.html
2019-05-11 12:25:07 +02:00
Vincent Dupont
e8619b327b thread: allow overriding THREAD_PRIORITY_MAIN 2019-03-20 14:09:16 +01:00
Marian Buschsieweke
4c3e92f183
core: Made thread state an enum
- Introduced enum type `thread_state_t` to replace preprocessor macros
- Moved thread states to `sched.h` for two reasons:
  a) Because of the interdependencies of `sched.h` and `thread.h` keeping it in
     `thread.h` would result in ugly code.
  b) Theses thread states are defined from the schedulers point of view, so it
     actually makes senses to have it defined there
2019-02-13 13:31:52 +01:00
4878cf2119
Merge pull request #10400 from miri64/core/enh/thread_has_queue_func
core: provide function to check msg queue initialization
2018-12-19 18:41:39 +01:00
Martine Lenders
7835db5ec3 core: provide function to check msg queue initialization
This makes it easier to refactor that part of the `thread_t` structure
later on.
2018-12-19 15:39:50 +01:00
Sebastian Meiling
43d39b7a33
Merge pull request #8333 from samkumar/feature-condition-variable
core: condition variable implementation
2018-11-30 21:15:53 +01:00
Sam Kumar
fb8edbb610 core: condition variable implementation 2018-11-30 11:22:07 -08:00
Gunar Schorcht
e75e0a5fe6 core: architecture dependent part in thread_t 2018-07-05 09:22:59 +02:00
Gunar Schorcht
c71f40370b core: add architecture dependent extension 2018-07-05 09:22:59 +02:00
2b1ed99a49 core: add more stacksize defines 2018-06-14 23:29:03 +02:00
bd2845adf6 core: fix doxygen grouping 2018-06-11 19:12:02 +02:00
e6a9a760a7 core/thread: add thread_getname() dummy available without DEVELHELP 2018-01-15 14:37:04 +01:00
Martine Lenders
4952ffbae7
Merge pull request #6698 from Lotterleben/doc_thread_h
thread.h: extend doc for msg_waiters and msg_array
2017-11-16 19:25:52 +01:00
Lotte Steenbrink
9cc3641b75 thread.h: extend doc for msg_waiters and msg_array 2017-11-16 10:15:46 -08:00
32c10ae2c9 core, cpu: rename thread_start_threading() -> cpu_switch_context_exit() 2017-11-16 14:40:16 +01:00
bb4a5c5cdf core: remove COREIF_NG 2017-11-16 14:39:54 +01:00
Joakim Nohlgård
87d322556a core/thread: fix Doxygen nesting
Everything below the thread states was cut off in the module
documentation because Doxygen does not handle nested @name tags.
2017-08-11 07:47:09 +02:00
Raul Fuentes
f21d497be4 tread.h: Minor examples compile 2017-05-30 20:48:57 +02:00
smlng
4ffbbfb8f6 doc: correct naming of doxygen group in core 2017-04-10 16:11:49 +02:00
Oleg Hahm
4e068bc1a4 doc: core: fix formatting 2017-01-16 18:04:04 +01:00
Ian Martin
28a7ddc9a8 core: save the stack_start in the thread context for mpu_stack_guard 2016-10-24 12:36:15 -04:00
Lotte Steenbrink
8bd0bd17f3 thread.h: rearrange docs, add small tutorial 2016-10-16 12:46:54 -07:00