Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cas ptr #5

Closed
diakopter opened this issue Sep 8, 2012 · 4 comments
Closed

cas ptr #5

diakopter opened this issue Sep 8, 2012 · 4 comments

Comments

@diakopter
Copy link

The header says "All operations operate on unsigned AO_t, which is the natural word size, and usually unsigned long".

Does this mean it can't CAS a pointer, or that it can? The APR has
apr underscore atomic underscore casptr
see http://apr.apache.org/docs/apr/trunk/group double underscore apr double underscore atomic.html
, which works for me on 64-bit. But I'm looking at using this library instead for the atomic operations because of the memory barrier precision. So I'm just wondering whether this library will let me CAS pointers on 64-bit.

Thanks again!

@ivmai
Copy link
Owner

ivmai commented Sep 8, 2012

Hi Matthew,

Sat, 8 Sep 2012 11:37:14 -0700 Matthew Wilson notifications@github.com:

The header says "All operations operate on unsigned AO_t, which is the natural word size, and usually unsigned long".

This should be refined, I think. AO_t is typically size_t which should be (normally) the same size of pointer.

Also, there could be atomic operations defined for other types (like char, short, int) on some platforms.

Does this mean it can't CAS a pointer, or that it can? The APR has apratomic_casptr (see http://apr.apache.org/docs/apr/trunk/group__apr__atomic.html), which works for me on 64-bit. But I'm looking at using this library instead for the atomic operations because of the memory barrier precision. So I'm just wondering whether this library will let me CAS pointers on 64-bit.

Yes, cast between a pointer type and AO_t is valid both on 32- and 64-bit targets.

Thanks again!

Reply to this email directly or view it on GitHub.

Regards,
Ivan

@diakopter
Copy link
Author

excellent; thanks

@diakopter
Copy link
Author

AO_compare_and_swap seems not to be implemented on msvc 32-bit. (tested with vs2010). Is it supposed to be?

@diakopter diakopter reopened this Jan 24, 2013
@diakopter
Copy link
Author

oops, reopened the wrong one

ivmai added a commit that referenced this issue Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants