http://mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706