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

112 Commits

Author SHA1 Message Date
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
Ludwig Ortmann
d8a5ee1ec8 core/msg: set m->sender_pid before it is used
fixes `msg_send_to_self` condition
2014-07-08 17:49:16 +02:00
Ludwig Ortmann
b6f2426d16 core/msg: revert part of #1285
use m->sender_pid instead of sched_active_pid again
undoes the optimization intended by #1285
fixes uint/int warning
2014-07-08 17:26:25 +02:00
Ludwig Ortmann
5c9a975afb core/msg: fix, optimize and improve
fixes:
fix race conditions by reordering dINTs
prevent null pointer dereference by adding forgotten target check
add forgotten eINTs
replace printf with DEBUG
fix debug messages

optimizations:
optimize pid access
reorder msg_send switches

improvements:
add debug statements
add missing return value to msg_send_to_self documentation
2014-07-08 11:57:38 +02:00
Oleg Hahm
ef5ec344fd core: prefix API functions correctly
Also changed names for bitarithm functions and rename thread_pid to sched_active_pid.
2014-05-18 08:53:20 +02:00
Christian Mehlis
7b91ea9349 core: fix warning about discarding volatile 2014-04-18 12:11:05 +02:00
Kévin Roussel
24f5cfafbb Add the ability to send a message to the current thread's message queue
(without raising an error)
2014-04-11 10:43:11 +02:00
622d473eb3 core: msg: yield after queueing of a message if REPLY_BLOCKED
When setting the running task reply_blocked, it is implicitly removed
from the runqueue. But if queueing of a msg is actually successful, the
thread exits msg_send without yielding, continuing to run even if it's
not supposed to.

Nice example of why multiple function exit points lead to weird
errors...
2014-02-13 11:33:18 +01:00
8d07b131db core: msg: add some debug statements 2014-02-12 19:16:42 +01:00
210a20b807 core: msg: don't wake up sender after receive if it's REPLY_BLOCKED
solves issue #100

If the sender is reply-blocked, waking it up after its message has been
delivered is wrong. It needs to stay reply-blocked until the reply has
been delivered.
2014-02-12 19:16:41 +01:00
56ee585c81 update Kaspar's email address
kaspar.schleiser@fu-berlin.de is obsolete.
(2nd try, first try was overwritten by some overzealous documenter)
2014-01-28 11:53:19 +01:00
Oleg Hahm
903ec54a43 making include directives consistent 2013-12-19 15:31:37 +01:00
Hauke Petersen
3785fe956b Fixed doxygen comments, focused on file headers and group definitions 2013-12-16 14:00:24 +01:00
aaf325c290 Merge pull request #400 from kaspar030/msg_cleanup
msg.c cleanup
2013-12-05 04:16:00 -08:00
23ecbde1a3 core: msg: whitespace fixes 2013-12-04 20:36:21 +01:00
94283789a7 core: msg: rename "n" to something more expressive ("queue_index") 2013-12-04 20:33:53 +01:00
af542058ee core: msg: whitespace fixes 2013-12-04 20:33:53 +01:00
f85adf608f change my email address
kaspar.schleiser@fu-berlin.de will be obsoleted soon. Replace it with
kaspar@schleiser.de, which will (hopefully) stay.
2013-12-04 15:09:56 +01:00
Ludwig Ortmann
d6c213fb47 fix grammar in license header 2013-11-23 13:11:56 +01:00
Oleg Hahm
e44412d0c1 added debug information to msg_send (similar to msg_send_int) 2013-11-03 06:46:13 -08:00
Ludwig Ortmann
f1b89df8d8 explain the "brainfuck condition" 2013-10-28 12:57:02 +01:00
Ludwig Ortmann
5e6cc92291 harmonize msg.c DEBUG statements
Use same order (function: [thread_name:] message) throughout msg.c.
Begin message with a capital letter.
2013-10-27 08:37:18 +01:00
Ludwig Ortmann
2d1303763e fix spelling in msg.c 2013-10-27 08:13:27 +01:00
Christian Mehlis
9ace6b4807 add missing inttypes include for PRI macros 2013-09-26 21:10:57 +02:00
Christian Mehlis
21ffebc197 add check for a not existing thread 2013-09-11 19:58:54 +02:00
LudwigOrtmann
07c7e8ccd3 Merge pull request #90 from OlegHahm/milestone_1_0_fixes
Milestone 1 0 fixes
2013-08-08 06:29:22 -07:00
Oleg Hahm
836ae0d291 fix #11: initialize queue_node_t n.next in msg_send() 2013-08-02 01:31:00 +02:00
Christian Mehlis
62994314aa in msg_send_receive: return result from msg_send 2013-08-01 22:03:55 +02:00
Oleg Hahm
599e266b55 Revert "removed redefined ENABLE_DEBUG"
This reverts commit 69c526f44d.

Instead of removing ENABLE_DEBUG, define it as zero and replacing the
ifdef preprocessor commands by a simple #if
2013-07-24 00:38:43 +02:00
Christian Mehlis
c5e62e238b add missing include 2013-07-16 15:27:19 +02:00
Christian Mehlis
69c526f44d removed redefined ENABLE_DEBUG 2013-07-16 15:27:19 +02:00
Christian Mehlis
190e24116d use int explicitly 2013-07-09 13:41:08 +02:00
Christian Mehlis
96cbf4019e make internal function static 2013-07-09 13:40:52 +02:00
Ludwig Ortmann
7dd9ac6be0 Add msg_try_receive 2013-07-05 23:32:07 +02:00
Oliver Hahm
c8bee9e554 fixed coding style (space after most keywords) 2013-06-24 22:37:35 +02:00
Oliver Hahm
ffeb6f8523 fixed coding conventions (correctly this time) 2013-06-20 18:18:29 +02:00
Oliver Hahm
0d6d8390c0 * updated copyright and license headers in various files 2013-06-18 17:21:38 +02:00
Oliver Hahm
0d6d3e2c43 [board msba2-common] [sys chardev_thread] [sys shell] [driver cc110x_ng] [core msg]
* some cosmetics and cleanups
2012-02-16 21:33:41 +01:00
Stephan Zeisberg
5abef6daf2 changed types irq_callback, hashtable, posix_io, s_display_flags, seq_buffer_entry, tcb, toprint to type_t" 2011-03-08 11:43:21 +01:00
Stephan Zeisberg
6a96de0d2f changed msg to msg_t 2011-03-08 10:54:40 +01:00
3a83ef0824 * msg queue optimization 2010-11-26 15:02:15 +01:00
cb79a7a237 * first implementation of msg queues 2010-11-26 14:21:48 +01:00
dc094d442b * fix msg_reply_int 2010-11-03 11:37:32 +01:00
1e238e4131 * massive name changes 2010-10-28 11:29:03 +02:00
7a8a07fe08 * msg: fix msg_reply 2010-10-28 10:12:45 +02:00
52bca573f4 * make msg_send use IRQ api
* msg_send_int now sets sender_pid to receiver_pid
2010-09-24 16:24:13 +02:00
91ae1eb6fd * import from old firekernel repository 2010-09-22 15:10:42 +02:00