On 06.05.2012, at 02:05, Andreas Grosam wrote:

> I would like to use OSAtomicCompareAndSwap32 and OSAtomicOr32Orig using the 
> same variable. Unfortunately, the first requires a signed int, the other an 
> unsigned int.
> 
> How can I get this to work?

Have you tried union{} ?

    union {
        int32_t s;
        uint32_t u;
    } atomicvar;
    atomicvar.u = 0;
    OSAtomicCompareAndSwap32(0, 1, &atomicvar.s);
    OSAtomicOr32Orig(0, &atomicvar.u);

-Stefan
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to