basho / eleveldb

Erlang LevelDB API
262 stars 177 forks source link

Type conversion of bool to ??? too tricky with Solaris CAS. #195

Closed matthewvon closed 8 years ago

matthewvon commented 8 years ago

A recent branch added atomic compare and set operations for the bool variable m_PrefetchStarted. This did not compile on Solaris. Solaris does have an 8-bit version of its compare set. But I did not find a document that guaranteed bool would be 8-bits. I could still use the 8-bit CAS, but would then have to assume all platforms were little endian.

Decided to take the safe and fast path. Changed m_PrefetchStarted to uint32_t. Then matched all the compare_and_swap() call parameters to match the existing compare_and_swap(volatile uint32_t *, int, int) function.

All platforms compile and test just fine now.

paulplace commented 8 years ago

+1 d989ced