Does performSelectorOnMainThread: preserve order?

  • Hi,

    The GNUstep documentation for the
    NSObject(NSMainThreadPerformAdditions) category states the following
    for performSelectorOnMainThread: withObject: waitUntilDone: modes:

    "Where this method has been called more than once before the runloop
    of the main thread runs in the required mode [i.e., with
    waitUntilDone:NO], the order in which the operations in the main
    thread is done is the same as that in which they were added using this
    method."
    [additions mine]

    However, there is no equivalent promise in Apple's documentation for
    NSObject; it is conspicuous in its absence. Can anyone confirm or deny
    that it has the same behaviour as in GNUstep?

    (This question was previously asked on this list in 2006
    (http://lists.apple.com/archives/cocoa-dev/2006/Feb/msg01215.html),
    but I can find no answer to it in the archives.)

    Thanks,
    Hamish
  • On Thu, Feb 28, 2008 at 5:31 PM, Hamish Allan <hamish...> wrote:
    >
    > However, there is no equivalent promise in Apple's documentation for
    > NSObject; it is conspicuous in its absence. Can anyone confirm or deny
    > that it has the same behaviour as in GNUstep?

    The documentation explicitly describes -[NSObject
    performSelectorOnMainThread:withObject:waitUntilDone:] as queueing and
    dequeueing selectors on the main thread.  It seems reasonable to
    assume they're not outright lying to you.

    --Kyle Sluder
  • On Thu, Feb 28, 2008 at 10:48 PM, Kyle Sluder
    <kyle.sluder+<cocoa-dev...> wrote:

    > The documentation explicitly describes -[NSObject
    > performSelectorOnMainThread:withObject:waitUntilDone:] as queueing and
    > dequeueing selectors on the main thread.  It seems reasonable to
    > assume they're not outright lying to you.

    Hey, it could have been a LIFO queue ;)

    Thanks!

    Hamish