• 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: Jean-Daniel Dupas <email@hidden>
  • Date: Wed, 02 Nov 2011 16:45:26 +0100

From the compiler point of view, the 'retain' semantic does not mean anything for an arbitrary type like dispatch queue.
So indicating the semantic to the compiler is pointless.

Now, if you want to expose the semantic to the developers that use this class, a simple comment is probably enough.



Le 2 nov. 2011 à 15:30, Andreas Grosam a écrit :

>
> On Nov 2, 2011, at 1:33 PM, Jamie Pinkham wrote:
>
>> Automatic property generation doesn't support the semantics you need.
>>
>> You are correct that you have to use the dispatch_retain() and dispatch_release() functions; you just have write your setter and getter manually, using those functions.
>
> Sure, the property can't  be synthesized. But even when I define setter and getter in the @implementation, I can't declare the property like:
>
> @proprty (retain) dispatch_queue_t dispatchQueue;
>
> in order to indicate the semantics,
>
> since the compiler (clang) will refuse it with
> "error: property with 'retain (or strong)' attribute must be of object type [3]"
>
>
> So, according the compiler, the property attribute "retain" does not indicate a certain (and general) semantic, but assumes a specific implementation applicable only for ObjC objects. Or, in other words, when I state "retain", then I shall use objects and if I implement setter and getter, they shall invoke retain and release.
>
> I would understand if the compiler would only complain about the "retain" attribute if it must synthesize it for "unknown" types.
>
> Andreas
>
>
>>
>> -Jamie
>>
>> Sent from my iPhone
>>
>> On Nov 2, 2011, at 7:52 AM, Andreas Grosam <email@hidden> 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
>
> _______________________________________________
>
> 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

-- Jean-Daniel




_______________________________________________

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: Jamie Pinkham <email@hidden>)
 >Re: dispatch queue as property (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: minor ARC casting question
  • Next by Date: Re: NSAssert no longer displaying reason in console
  • Previous by thread: Re: dispatch queue as property
  • Next by thread: How to prevent redrawing window when resized
  • Index(es):
    • Date
    • Thread