This patch fixes the compiler warnings caused by the invalid use of const.
It also provides a certain level of encapsulation when parsing the thread_event data. Some of the macros could be merged simplifying the code a bit more but I am not sure if it would make the code too obfuscated.