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

core: disallow msg_send_receive() on same thread

This commit is contained in:
Oleg Hahm 2015-08-23 20:31:25 +02:00
parent 8da80ee878
commit bb306038ae
2 changed files with 5 additions and 0 deletions

View File

@ -184,6 +184,9 @@ int msg_try_receive(msg_t *m);
*
* @note CAUTION! Use this function only when receiver is already waiting.
* If not use simple msg_send()
*
* @pre @p target_pid is not the PID of the current thread.
*
* @param[in] m Pointer to preallocated ``msg_t`` structure with
* the message to send, must not be NULL.
* @param[out] reply Pointer to preallocated msg. Reply will be written

View File

@ -22,6 +22,7 @@
#include <stddef.h>
#include <inttypes.h>
#include <assert.h>
#include "kernel.h"
#include "sched.h"
#include "msg.h"
@ -214,6 +215,7 @@ int msg_send_int(msg_t *m, kernel_pid_t target_pid)
int msg_send_receive(msg_t *m, msg_t *reply, kernel_pid_t target_pid)
{
assert(sched_active_pid != target_pid);
unsigned state = disableIRQ();
tcb_t *me = (tcb_t*) sched_threads[sched_active_pid];
sched_set_status(me, STATUS_REPLY_BLOCKED);