http://mbed.org/users/mbed_official/code/rtx/#5a95354ca0a2