Re: How to count Atoms
Re: How to count Atoms
- Subject: Re: How to count Atoms
- From: Ken Thomases <email@hidden>
- Date: Fri, 07 Oct 2016 03:43:44 -0500
On Oct 7, 2016, at 2:19 AM, Gerriet M. Denkmann <email@hidden> wrote:
>
> I need (just for debugging purposes) to count something in a thread safe way.
> […]
> So I tried OSIncrementAtomic.
> Now I get: "Implicit declaration of function 'OSIncrementAtomic' is invalid in C99" and the linker fails, because it does not find it.
> #import <libkern/OSAtomic.h> does not help at all.
These problems are all because you're using the wrong name.
If you #import <libkern/OSAtomic.h> then you get the declaration of OSAtomicIncrement32() (among other things). Note this is not the name you tried (OSIncrementAtomic). If you use the right name, the compiler warning and linker error will go away.
Regards,
Ken
_______________________________________________
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