MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / CAS

Function CAS

benchmarks/tbb/spin_rw_mutex.cpp:34–38  ·  view source on GitHub ↗

a template can work with private spin_rw_mutex::state_t

Source from the content-addressed store, hash-verified

32
33template<typename T> // a template can work with private spin_rw_mutex::state_t
34static inline T CAS(volatile T &addr, T newv, T oldv) {
35 // ICC (9.1 and 10.1 tried) unable to do implicit conversion
36 // from "volatile T*" to "volatile void*", so explicit cast added.
37 return tbb::internal::as_atomic(addr).compare_and_swap( newv, oldv );
38}
39
40//! Acquire write lock on the given mutex.
41bool spin_rw_mutex_v3::internal_acquire_writer()

Callers 3

internal_upgradeMethod · 0.85

Calls 1

compare_and_swapMethod · 0.45

Tested by

no test coverage detected