• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Return value of performSelector:onThread:?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return value of performSelector:onThread:?


  • Subject: Re: Return value of performSelector:onThread:?
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 8 Oct 2010 11:52:11 -0700

On Thu, Oct 7, 2010 at 10:49 PM, Abhi Beckert <email@hidden> wrote:
> I have a background thread which needs the main thread to create an object (because part of the initializer isn't thread safe).
>
> The performSelector: methods don't expose the return value of the message, even with waitUntilDone:YES. I'm not happy with my workaround, which is to use an instance variable:
>
> Has anyone else got a cleaner technique? Perhaps provide an NSMutableDictionary to withObject: ?

Using GCD:

id myObj;
dispatch_sync(dispatch_get_main_queue(), ^{ myObj = CreateTheObject(); });

--Kyle Sluder
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Return value of performSelector:onThread:?
      • From: Bill Bumgarner <email@hidden>
References: 
 >Return value of performSelector:onThread:? (From: Abhi Beckert <email@hidden>)

  • Prev by Date: Re: Not understanding NSString's compare:options:range:locale: method
  • Next by Date: Re: Return value of performSelector:onThread:?
  • Previous by thread: Return value of performSelector:onThread:?
  • Next by thread: Re: Return value of performSelector:onThread:?
  • Index(es):
    • Date
    • Thread