Hi All!
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?
Example:
enum {
State_Canceling = 1U << 7;
};
int _state; // would like to have an uint32_t
int new_state = OSAtomicCompareAndSwap32(State_0, State_1, &_state);
…
if (OSAtomicOr32Orig(State_Canceling, &_state) != 0) {
// canceling
}
The solution would be a "OSAtomicCompareAndSwapU32", or is it save to pass a
signed int where an unsigned int is required, considering strong Alias rules
and whatever optimizations the compiler applies?
Thanks for tips!
Reagards
Andreas
_______________________________________________
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]