Fix casting of the return value integer to a pointer in the thread lib

This fixes building of the thread lib on 64 bit unix.