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

96 Commits

Author SHA1 Message Date
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
Ludwig Ortmann
535839f2d5 core/msg: use disable/restoreIRQ
* needed to change internal `msg_send` to allow external disabling of interrupts
2014-11-25 19:38:36 +01:00
René Kijewski
ff2a1dc61b core: remove needless test in msg.c
`thread.c` initializes a thread with an empty message queue. `cib_put()`
will `return -1` for an empty CIB, so there is no need to test if
`thread->msg_array != NULL`.
2014-11-14 10:54:33 +01:00
Oleg Hahm
a262de0678 core: always set sender_pid in msg_send_int 2014-11-10 09:29:16 +01:00
René Kijewski
c3ba66781d core: put more intelligence into queue_msg()
Fixes #1942.

There were two instances were it was not checked the target thread has a
message queue before queuing the message.

This PR centralizes the check into `queue_msg()`.
2014-11-07 12:32:15 +01:00
Oleg Hahm
8dab420321 Merge pull request #1835 from OlegHahm/msg_receive_yield
core: msg_receive should yield
2014-11-06 16:27:32 +01:00
Oleg Hahm
4fd3d62f2a core: msg_receive should yield
If a thread sends blocking, but the target thread is not currently in
receive mode, the sender gets queued. If it has a higher priority it
should run again as soon as the target goes into receiving mode.
2014-11-06 15:35:28 +01:00
Ludwig Ortmann
eceb656c49 core,sys: fix storage types for irq API usage
* should not have any effect as long as `unsigned` and `int` are compatible
* also fix two cosmetic `unsigned int` -> `unsigned` for consistency
2014-10-27 16:25:23 +01:00
René Kijewski
677d690e2b core: introduce thread_yield_higher(), yield less
Fixes #1708.

Currently involuntary preemption causes the current thread not only to
yield for a higher prioritized thread, but all other threads of its own
priority class, too.

This PR adds the function `thread_yield_higher()`, which will yield the
current thread in favor of higher prioritized functions, but not for
threads of its own priority class.

Boards now need to implement `thread_yield_higher()` instead of
`thread_yield()`, but `COREIF_NG` boards are not affected in any way.

`thread_yield()` retains its old meaning: yield for every thread that
has the same or a higher priority.

This PR does not touch the occurrences of `thread_yield()` in the periph
drivers, because the author of this PR did not look into the logic of
the various driver implementations.
2014-10-24 00:09:56 +02:00
5146c66786 core: adapt to msg_try_send 2014-10-22 12:37:33 +02:00
bdcac07faa core: msg: introduce msg_try_send 2014-10-22 12:37:33 +02:00
Ludwig Ortmann
cd3dff3f2e core/msg: add DEVELHELP checks for valid pid 2014-10-13 19:44:35 +02:00
Ludwig Ortmann
c2b2e4554b core/queue: queue -> priority_queue
Rename queue to priority queue, because that's what it is.
2014-08-05 17:57:45 +02:00
Oleg Hahm
983d056c75 core: harmonizes the data type for the process ID
Instead of using differing integer types use kernel_pid_t for process
identifier. This type is introduced in a new header file to avoid
circular dependencies.
2014-08-01 12:02:54 +02:00
Ludwig Ortmann
3ca4f18479 doc: use lgplv2.1-short license header instead of lgpl-short-riot 2014-07-31 22:57:20 +02:00
Ludwig Ortmann
b6846e31fc doc: fix most occurences of FU as an author
.. but only if there are other authors as well
2014-07-29 17:23:11 +02:00
Ludwig Ortmann
2a859c78cd SQUASHME: do it right 2014-07-08 18:00:54 +02:00