checkIsOnMainThread

Throws exception if called from other than main thread.