sys: Add generic pipe

This PR adds a generic pipe. You can write to it and read from it.
If the pipe is empty and one reads from it, then the threads gets laid to sleep. Same for writing.
The implementation takes care of interrupts, and won't send the current thread sleeping in an ISR.

*[edit]* This PR is (re)based on ~~#933~~ #1101. *[/edit]*