Is there a way in iOS / Monotouch to detect whether code is being called in the main thread?
I'm looking for something like the equivalent of Java's
EventQueue.isEventDispatchThread() -- I've found in Swing programming it's handy to
assert that from time to time (or sometimes to
assert that it's not) -- making sure that models are consistently updated and read from the EDT, and that long-running calls don't block the UI.
I'd like to do the same in my MonoTouch app, to ensure that various bits of code are/aren't called from the UI, or wrapped in
Updated: For anyone coming along later: Obj-C answer from JP below . The MonoTouch equivalent is