hamcast
Version 0.7
|
Classes | |
class | buffered_sink |
class | buffered_source |
struct | closeable |
class | comparable |
class | const_buffer |
class | deserializer |
class | future |
class | id_generator |
struct | mock_mutex |
class | read_buffer |
class | serializer |
class | single_reader_queue |
struct | sink |
struct | source |
struct | unit |
class | write_buffer |
Functions | |
template<typename T > | |
bool | atomic_cas (volatile T **ptr, T *ptr_expected, T *ptr_new) |
boost::int32_t | add_and_fetch (volatile boost::int32_t *ptr, boost::int32_t value) |
This namespace contains utility classes.
boost::int32_t hamcast::util::add_and_fetch | ( | volatile boost::int32_t * | ptr, |
boost::int32_t | value | ||
) |
Atomically increase the content of ptr
by value
and return the new content of ptr
.
ptr | Memory location of the variable. |
value | The value you want to add to ptr . |
ptr
. bool hamcast::util::atomic_cas | ( | volatile T ** | ptr, |
T * | ptr_expected, | ||
T * | ptr_new | ||
) |
Atomically compare the content of ptr
to ptr_expected
and, if they are the same, modify it to ptr_new
.
Platform dependent, atomic compare-and-swap operation.
ptr | Memory location of the variable |
ptr_expected | The value you expect *ptr to be |
ptr_new | The value which should be stored in *ptr |
ptr
was set to ptr_new
; otherwise false