Enforce main thread for public API.