core: Add the ability to send a message to the current thread's message queue

This possibility replaces the current behavior of msg_send() that is: to treat this situation as an error.

Being able to send messages inside the same thread is a elegant way to replace flags and other global variables: it especially helps building finite state machines.