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

Already on GitHub? Sign in to your account

cas ptr #5

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

Comments

Projects
None yet
2 participants

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!

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

excellent; thanks

@diakopter diakopter closed this Sep 8, 2012

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

oops, reopened the wrong one

@diakopter diakopter closed this Jan 24, 2013

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