Add support for several platforms to obtain the real thread ID.