Skip to content
Snippets Groups Projects
Commit bb306038 authored by Oleg Hahm's avatar Oleg Hahm
Browse files

core: disallow msg_send_receive() on same thread

parent 8da80ee8
Branches
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment