More about NSRunLoop

From EOFWiki
Jump to: navigation, search

This is the order in which on Mac OS X 10.5 runloop methods execute. Assume that the RunLoop is triggered by a button event which calls "action". We assume this NSRunLoop exists on the main thread, which it should in EOInterface. The action: method itself starts a few delayed NSRunLoop methods.

  • start of action:
  • [self performSelectorOnMainThread:withObject:waitUntilDone:YES modes:]
  • detach a thread [self performSelectorOnMainThread:withObject:waitUntilDone:YES modes:] (*)
  • end of action1:
  • Methods registered with EOFlushEOEditingContextRunLoopOrdering are called
  • Methods registered with EOFlushDelayedObserversRunLoopOrdering are called
  • [self performSelectorOnMainThread:withObject:waitUntilDone:NO modes:]
  • detach a thread [self performSelectorOnMainThread:withObject:waitUntilDone:NO modes:]

(*) this could also happen anytime afterwards, but it can happen as soon as in action

Since the EODisplayGroup must ensure that EOEditingContext notifications are handled on the main thread, since it isn't threadsafe but should execute ahead of EOFlushDelayedObserversRunLoopOrdering it should use [self performSelectorOnMainThread:withObject:waitUntilDone:YES].

Personal tools