Fix some thread issues

This resolves two minor issues: It initializes the main stack bottom reference safely even with --threads:on and it removes an unnecessary reference to pthread_mutex_timedlock(), which can prevent compilation with C++ and --threads:on on architectures that do not have this function.