If you needed this information in your application, would you not just set a global pointer to it as the app starts up - and you know you are in the main thread - for later use..? Gets rid of any possible deadlocks...