{
returnm_Counter.Get(); }
149{ m_Counter.Set(new_value); }
153{
returnm_Counter.Add(
delta); }
170 #ifdef NCBI_COUNTER_RESERVED_VALUE 173 while(
value== NCBI_COUNTER_RESERVED_VALUE) {
194 #if defined(NCBI_COUNTER_USE_ASM) && (!defined(NCBI_COMPILER_WORKSHOP) || defined(NCBI_COUNTER_IMPLEMENTATION)) 195 # ifndef NCBI_COMPILER_WORKSHOP 203TValue* nv_value_p =
const_cast<TValue*
>(value_p);
207TValue old_value = *value_p;
211 # ifdef NCBI_COMPILER_WORKSHOP 212 result= NCBICORE_asm_cas(
result, nv_value_p, old_value);
214 asm volatile(
"cas [%3], %2, %1":
"=m"(*nv_value_p),
"+r"(
result)
215:
"r"(old_value),
"r"(nv_value_p),
"m"(*nv_value_p));
217 if(
result== old_value) {
223 # elif defined(__sparc) 224 result= NCBI_COUNTER_RESERVED_VALUE;
227 # ifdef NCBI_COMPILER_WORKSHOP 230 asm volatile(
"swap [%2], %1":
"=m"(*nv_value_p),
"+r"(
result)
231:
"r"(nv_value_p),
"m"(*nv_value_p));
233 if(
result!= NCBI_COUNTER_RESERVED_VALUE) {
240 # elif defined(__i386) || defined(__x86_64) 242 # ifdef NCBI_COUNTER_64_BIT 243 asm volatile(
"lock; xaddq %1, %0":
"=m"(*nv_value_p),
"=r"(
result)
244:
"1"(
Int8(
delta)),
"m"(*nv_value_p));
246 asm volatile(
"lock; xaddl %1, %0":
"=m"(*nv_value_p),
"=r"(
result)
247:
"1"(
delta),
"m"(*nv_value_p));
250 # elif defined(__aarch64__) 251 # ifdef __ARM_FEATURE_ATOMICS 252 asm volatile(
"ldaddal %2, %0, %1":
"=&r"(
result),
"+Q"(*nv_value_p)
257 register intundone
asm(
"w9") = 1;
259 asm volatile(
"ldxr %1, %2\n\tadd %1, %1, %3\n\tstlxr w9, %1, %2" 260:
"=&r"(undone),
"=&r"(
result),
"+Q"(*nv_value_p)
268 # error "Unsupported processor type for assembly implementation!" 274 #if !defined(NCBI_COUNTER_NEED_MUTEX) && (!defined(NCBI_COUNTER_USE_EXTERN_ASM) || defined(NCBI_COUNTER_IMPLEMENTATION)) 275 # ifndef NCBI_COUNTER_USE_EXTERN_ASM 280TData* nv_value_p =
const_cast<TData*
>(&m_Value);
CAtomicCounter_WithAutoInit â.
CMutableAtomicCounter â.
Include a standard set of the NCBI C++ Toolkit most basic headers.
TValue Add(int delta) const THROWS_NONE
Atomically add value (=delta), and return new counter value.
void Set(TValue new_value) const THROWS_NONE
Set atomic counter value.
CAtomicCounter_WithAutoInit(TValue initial_value=0)
TNCBIAtomicValue TValue
Alias TValue for TNCBIAtomicValue.
typedef NCBI_ATOMIC_TYPE(TValue) TData
Define NCBI_COUNTER_ADD if one has not been defined.
TValue Get(void) const THROWS_NONE
Get atomic counter value.
void Set(TValue new_value) THROWS_NONE
Set atomic counter value.
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
CAtomicCounter m_Counter
Mutable atomic counter value.
volatile TData m_Value
Internal counter value.
CAtomicCounter::TValue TValue
Alias TValue simplifies syntax.
TValue Get(void) const THROWS_NONE
Get atomic counter value.
#define THROWS_NONE
Do not use 'throw' dynamic exception specification for C++11 compilers.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define NCBI_SCHED_SPIN_INIT()
#define NCBI_SCHED_SPIN_YIELD()
size_t TNCBIAtomicValue
Define platform specific atomic-operations macros/values.
#define NCBI_COUNTER_ADD(p, d)
#define NCBI_XNCBI_EXPORT
const GenericPointer< typename T::ValueType > T2 value
(Highly!) platform-specific configuration for low-level atomic operations (reference-count manipulati...
Int4 delta(size_t dimension_, const Int4 *score_)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4