Fabian Hüßler
85e3988133
core/msg: better DEBUG() in queue_msg
2023-10-22 10:50:00 +02: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
Mingjie Shen
3fad959eb6
core: fix null pointer dereference
...
Check return values of following functions for null:
- thread_get
- thread_get_unchecked
2023-07-05 14:50:27 -04:00
Benjamin Valentin
37116d359e
core: replace RIOT_FILE_RELATIVE with __FILE__
2022-11-19 01:48:42 +01:00
Jan Mohr
e0febd08e8
core/msg.c: irq was not restored properly
2022-09-16 15:56:17 +02:00
0c87335a45
core/msg: yield after thread_flags_wake() in queue_msg()
2022-04-21 17:28:41 +02:00
Martine Lenders
bb89334322
core: add functionality to check queue state of another thread
2022-03-03 16:50:34 +01:00
Benjamin Valentin
b5ea78ad47
core/msg: make msg_avail() return 0 on no queue
...
For the caller there should be no difference if there is no message
in the queue and if there can't be a message in the queue.
The current API works as one would expect if there is a message queue,
but once called from a thread that does not have a message queue
configured, code that does
while (msg_avail())
will end up in an infinite loop.
Remove this foot-gun from the API by making the return value of
msg_avail() independend of the availability of a message queue.
2021-11-29 12:04:16 +01:00
JulianHolzwarth
8309889e39
core/msg.c: fixed msg_queue_print()
2021-06-02 01:28:22 +02:00
Joakim Nohlgård
87727febd7
core/msg: Fix mismatched printf bool format
...
_Bool will be extended to int when calling the variadic printf function.
2021-03-24 12:01:23 +01:00
Joakim Nohlgård
783c407787
core/msg: Fix mismatched printf signed/unsigned format
...
enum signedness depends on the platform settings, use explicit casts for robustness
2021-03-24 12:01:18 +01:00
Joakim Nohlgård
a83516b2f6
core/msg: Fix mismatched printf signed/unsigned format
...
cib_avail returns unsigned int
2021-03-24 12:01:07 +01:00
Martine Lenders
9b40bb63c2
core: apply uncrustify patches
2021-02-02 22:21:14 +01:00
benpicco
ee7a52db2f
Merge pull request #14023 from benpicco/core/msg_bus-bus_flag
...
core/msg_bus: allow to differ between messages form bus and from thread
2020-11-03 13:51:19 +01:00
Benjamin Valentin
d6a6c218a3
core/msg_bus: allow to differ between messages form bus and from thread
...
Currently it is not possible to check if a message was sent over a bus
or if it was send the usual way using `msg_send()`.
This adds a flag to the `sender_pid` if the message was sent over a bus.
`MAXTHREADS` is currently set to 32, so there is still plenty of room in
the PID space. (`kernel_pid_t` is `int16_t`)
The message type for bus message type is already accessed through a getter
function, so it's just consistent to do the same for sender_pid.
2020-11-03 10:52:43 +01:00
Bas Stottelaar
e675b6379e
core/*: realign ENABLE_DEBUG
2020-10-23 00:45:56 +02:00
Marian Buschsieweke
57264c5059
core: Access internal vars via helper funcs
...
Replace accesses to `sched_active_thread`, `sched_active_pid`, and
`sched_threads` with `thread_get_active()`, `thread_get_active_pid()`, and
`thread_get_unchecked()` where sensible.
2020-08-06 16:47:33 +02:00
1bb3d56bd5
core/msg: sched_threads[sched_active_pid] -> sched_active_thread
...
Same result, but only a single volatile read.
2020-08-06 12:46:26 +02:00
Benjamin Valentin
46b89eb723
core/msg_bus: fix shift on 8-bit platforms
...
The previous shift would wrap if the compiler defaults to 16 bit words.
Use explicit `unsigned long` integer constants to mitigate that.
before:
2020-07-22 15:25:17,063 # THREAD 1 start
2020-07-22 15:25:17,063 # THREAD 2 start
2020-07-22 15:25:17,065 # THREAD 3 start
2020-07-22 15:25:17,066 # THREADS CREATED
2020-07-22 15:25:17,068 # Posted event 22 to 0 threads
2020-07-22 15:25:17,071 # Posted event 23 to 0 threads
2020-07-22 15:25:17,076 # Posted event 24 to 0 threads
2020-07-22 15:25:17,076 # SUCCESS
2020-07-22 15:26:00,188 # Exiting Pyterm
after:
2020-07-22 15:26:10,374 # THREAD 1 start
2020-07-22 15:26:10,374 # THREAD 2 start
2020-07-22 15:26:10,377 # THREAD 3 start
2020-07-22 15:26:10,377 # THREADS CREATED
2020-07-22 15:26:10,380 # Posted event 22 to 0 threads
2020-07-22 15:26:10,383 # T1 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,386 # T3 recv: Hello Threads! (type=23)
2020-07-22 15:26:10,388 # Posted event 23 to 2 threads
2020-07-22 15:26:10,391 # T2 recv: Hello Threads! (type=24)
2020-07-22 15:26:10,394 # Posted event 24 to 1 threads
2020-07-22 15:26:10,396 # SUCCESS
2020-07-22 15:27:31 +02:00
Benjamin Valentin
b3eb59c30e
core/msg: add message bus
2020-04-28 13:35:05 +02:00
Benjamin Valentin
866c37c6b0
core/msg: split msg_send_int() into helper function
...
So it can be re-used for the message bus.
2020-04-28 11:30:56 +02:00
8efe5960aa
core: uncrustify
2020-03-30 17:02:08 +02:00
82b2362bc3
core/msg: add assert for problem identified in #10881
2019-01-28 17:14:16 +01:00
Kees Bakker
920d8b8805
core: remove redundant casts
2019-01-09 23:00:50 +01:00
Martine Lenders
c8937f8d40
core: use thread_has_msg_queue() for message queue check
2018-12-19 15:39:50 +01:00
Joakim Nohlgård
ef01efc387
core/msg: Set THREAD_FLAG_MSG_WAITING when queueing messages
2017-08-30 12:04:47 +02:00
68f13467d3
core: remove redundant includes
2017-08-02 14:27:55 +02:00
0b10dccf64
core: adapt to Makefile.submodule
2017-03-28 20:50:48 +02:00
7718f114cb
all: remove pointer casts for msg.content.ptr
2016-06-02 23:13:42 +02:00
Oleg Hahm
dc7d191748
core: msg_send_receive if receiver is not ready
2016-05-31 20:06:35 +02:00
Oleg Hahm
8690a888f5
Merge pull request #5295 from OlegHahm/msg_init_queue_assert
...
core: assert correct msq queue size on creation
2016-04-17 14:49:54 +02:00
Oleg Hahm
bb35913840
core: assert correct msq queue size on creation
...
The return value was never checked. Hence, this runtime check was rather
pointless. Better assert the correct size during development.
2016-04-17 13:55:21 +02:00
dc8f55df7e
core: msg: use new list instead of priority_queue
2016-04-10 00:16:48 +02:00
58a12e5034
core: make messaging optional
2016-03-30 23:27:09 +02:00
DipSwitch
0bb4748a94
core: Fix/refactor function naming in core/incude/irq.h
2016-03-20 16:47:34 +01:00
2b010b5337
core: rename tcb_t -> thread_t, move into thread.h
2016-03-05 18:20:17 +01:00
Joakim Nohlgård
e088403ce0
Merge pull request #4082 from daniel-k/pr/msg_reply_missing_irq_restore
...
core/msg: add missing irq restoration in msg_reply()
2016-03-04 15:59:06 +01:00
daniel-k
4295d028ec
core/msg_reply: only assert target tcb, no error handling
2016-03-01 21:34:01 +01:00
9082273746
core: header cleanup
2016-02-28 22:46:28 +01:00
bdfc76a052
core: msg: fix msg_try_receive not checking msg_waiters
2016-02-23 14:43:42 +01:00
Hauke Petersen
7f5ab0cd5f
core: moved flags.h to thread.h
2015-12-07 22:09:46 +01:00
DipSwitch
15e8f4e3d1
core: add support to see if there are messages available for the current thread
2015-12-02 09:08:15 +01:00
Oleg Hahm
bb306038ae
core: disallow msg_send_receive() on same thread
2015-09-29 12:45:27 +02:00
Oleg Hahm
e15bdd257a
debug: replace __FILE__ by RIOT_RELATIVE_FILE
2015-09-20 01:51:47 +02:00
Oleg Hahm
49917a5797
core: cpu: fix check for DEVELHELP
2015-09-12 12:43:15 +02:00
Lucas Jenss
426170b064
Improve naming of thread stacksize/priority constants
...
As discussed in #2725 , this commit renames a number of stacksize constants to
better convey their intended usage. In addition, constants for thread priority
are given a `THREAD_` prefix. Changes are:
* KERNEL_CONF_STACKSIZE_PRINTF renamed to THREAD_EXTRA_STACKSIZE_PRINTF
* KERNEL_CONF_STACKSIZE_DEFAULT renamed to THREAD_STACKSIZE_DEFAULT
* KERNEL_CONF_STACKSIZE_IDLE renamed to THREAD_STACKSIZE_IDLE
* KERNEL_CONF_STACKSIZE_MAIN renamed to THREAD_STACKSIZE_MAIN
* Move thread stacksizes from kernel.h to thread.h, since the prefix changed
* PRIORITY_MIN renamed to THREAD_PRIORITY_MIN
* PRIORITY_IDLE renamed to THREAD_PRIORITY_IDLE
* PRIORITY_MAIN renamed to THREAD_PRIORITY_MAIN
* Move thread priorities from kernel.h to thread.h since the prefix has changed
* MINIMUM_STACK_SIZE renamed to THREAD_STACKSIZE_MINIMUM for consistency
2015-05-21 00:14:23 +02:00
Martine Lenders
4e7a32efc1
core: Allow debug messages without DEVELHELP
2015-04-10 09:15:34 +02:00
René Kijewski
5f29fed076
core: introduce msg_sent_by_int()
...
msg_send_int() sets `m->sender_pid = target_pid`. This was used to flag a
message as having been sent by an ISR.
This PR introduces a static inline function `msg_sent_by_int()` and a
specific define for this purpose.
2014-12-18 23:04:03 +01:00
Martine Lenders
c0b0110de9
core: Fix msg_send_receive
...
Fixes #1935
2014-12-03 15:42:37 +01:00
Ludwig Ortmann
b4d9c9e6b7
core/msg: coding convention cleanup
2014-11-25 19:38:36 +01:00