• 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: dispatch queue as property
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dispatch queue as property


  • Subject: Re: dispatch queue as property
  • From: Jamie Pinkham <email@hidden>
  • Date: Wed, 02 Nov 2011 09:11:48 -0400

Bruno,

> @property (nonatomic, retain) dispatch_queue_t *dispatchQueue;


Let's assume for a second that this worked.  Since dispatch_queue_t is already typedef'd as a pointer  "typedef struct dispatch_queue_s *dispatch_queue_t;". You've declared the property as a pointer to a pointer, which means that he would have to dereference that pointer in his class that has the property, every time he uses it.

Secondly, dispatch_queue_t doesn't subclass NSObject, or implement the NSObject protocol, and therefore doesn't implement the -[retain] message.  The auto-generated getter and setter would crash.

-Jamie

EDIT: re-sent to list.


On Nov 2, 2011, at 8:02 AM, Bruno Berisso wrote:

> Hi Andreas.
>
> I assuming that you aren't using ARC, right?
> Be aware that the property declaration that you send doesn't retain anything. The declaration should by:
>
> @property (nonatomic, retain) dispatch_queue_t *dispatchQueue;
>
> On Nov 2, 2011, at 9:52 AM, Andreas Grosam wrote:
>
>> I want to set a dispatch queue via a property. How should I set the property's attributes when the queue is retained/released via functions dispatch_retain() and dispatch_release()?
>>
>> Currently, since using "retain" is only possible for objects, I just declare it like follows:
>>
>> @property (nonatomic) dispatch_queue_t dispatchQueue;
>>
>>
>> But here, the retain/release semantic isn't exposed. Any better ideas?
>>
>>
>>
>> _______________________________________________
>>
>> 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
>
> --
> SouthLabs |  www.southlabs.com
> Apple recommends SharePlus
>
> SharePlus: NOW for MAC !!!
>
> _______________________________________________
>
> 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

_______________________________________________

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

References: 
 >dispatch queue as property (From: Andreas Grosam <email@hidden>)
 >Re: dispatch queue as property (From: Bruno Berisso <email@hidden>)

  • Prev by Date: Re: dispatch queue as property
  • Next by Date: Re: dispatch queue as property
  • Previous by thread: Re: dispatch queue as property
  • Next by thread: Re: dispatch queue as property
  • Index(es):
    • Date
    • Thread