threads.h: define __noreturn and __restrict for C++

Signed-off-by: Steven Noonan <steven@uplinklabs.net>