Panda3D
|
A trivial implementation for atomic adjustments for systems that don't require multiprogramming, and therefore don't require special atomic operations. More...
#include "atomicAdjustDummyImpl.h"
Public Types | |
typedef long | Integer |
typedef void * | Pointer |
Static Public Member Functions | |
static void | add (Integer &var, Integer delta) |
Atomically computes var += delta. More... | |
static Integer | compare_and_exchange (Integer &mem, Integer old_value, Integer new_value) |
Atomic compare and exchange. More... | |
static Pointer | compare_and_exchange_ptr (Pointer &mem, Pointer old_value, Pointer new_value) |
Atomic compare and exchange. More... | |
static bool | dec (Integer &var) |
Atomically decrements the indicated variable and returns true if the new value is nonzero, false if it is zero. More... | |
static Integer | get (const Integer &var) |
Atomically retrieves the snapshot value of the indicated variable. More... | |
static Pointer | get_ptr (const Pointer &var) |
Atomically retrieves the snapshot value of the indicated variable. More... | |
static void | inc (Integer &var) |
Atomically increments the indicated variable. More... | |
static Integer | set (Integer &var, Integer new_value) |
Atomically changes the indicated variable and returns the original value. More... | |
static Pointer | set_ptr (Pointer &var, Pointer new_value) |
Atomically changes the indicated variable and returns the original value. More... | |
A trivial implementation for atomic adjustments for systems that don't require multiprogramming, and therefore don't require special atomic operations.
Definition at line 29 of file atomicAdjustDummyImpl.h.
|
inlinestatic |
Atomically computes var += delta.
It is legal for delta to be negative.
Definition at line 45 of file atomicAdjustDummyImpl.I.
References set().
Referenced by dec(), MemoryHook::dec_heap(), MemoryHook::heap_alloc_array(), MemoryHook::heap_alloc_single(), MemoryHook::heap_free_array(), MemoryHook::heap_free_single(), MemoryHook::heap_realloc_array(), and MemoryHook::inc_heap().
|
inlinestatic |
Atomic compare and exchange.
If mem is equal to old_value, store new_value in mem. In either case, return the original value of mem. The caller can test for success by comparing return_value == old_value.
Definition at line 115 of file atomicAdjustDummyImpl.I.
References compare_and_exchange_ptr().
Referenced by DeletedBufferChain::deallocate(), get_ptr(), and UpdateSeq::is_special().
|
inlinestatic |
Atomic compare and exchange.
As above, but works on pointers instead of integers.
Definition at line 133 of file atomicAdjustDummyImpl.I.
Referenced by AttribNodeRegistry::clear(), compare_and_exchange(), Filename::get_common_appdata_directory(), Filename::get_home_directory(), Filename::get_temp_directory(), Filename::get_user_appdata_directory(), and AudioManager::shutdown().
|
inlinestatic |
Atomically decrements the indicated variable and returns true if the new value is nonzero, false if it is zero.
Definition at line 34 of file atomicAdjustDummyImpl.I.
References add().
Referenced by CachedTypedWritableReferenceCount::cache_unref(), NodeCachedReferenceCount::get_referenced_bits(), inc(), CachedTypedWritableReferenceCount::test_ref_count_integrity(), NodeReferenceCount::test_ref_count_integrity(), and ReferenceCount::unref().
|
inlinestatic |
Atomically retrieves the snapshot value of the indicated variable.
This is the only guaranteed safe way to retrieve the value that other threads might be asynchronously setting, incrementing, or decrementing (via other AtomicAjust methods).
Definition at line 72 of file atomicAdjustDummyImpl.I.
References set_ptr().
Referenced by UpdateSeq::fresh(), CachedTypedWritableReferenceCount::get_cache_ref_count(), NodeReferenceCount::get_node_ref_count(), NodeCachedReferenceCount::get_node_ref_count(), ReferenceCount::get_ref_count(), UpdateSeq::get_seq(), MemoryHook::heap_alloc_array(), MemoryHook::heap_alloc_single(), UpdateSeq::is_fresh(), UpdateSeq::is_initial(), UpdateSeq::is_old(), UpdateSeq::is_special(), set(), and DeletedBufferChain::validate().
|
inlinestatic |
Atomically retrieves the snapshot value of the indicated variable.
This is the only guaranteed safe way to retrieve the value that other threads might be asynchronously setting, incrementing, or decrementing (via other AtomicAjust methods).
Definition at line 100 of file atomicAdjustDummyImpl.I.
References compare_and_exchange().
Referenced by TypedWritable::decode_raw_from_bam_stream(), Filename::get_common_appdata_directory(), Filename::get_home_directory(), Filename::get_temp_directory(), Filename::get_user_appdata_directory(), ReferenceCount::get_weak_list(), ThreadSafeConstPointerTo< T >::operator const T *(), ThreadSafePointerTo< T >::operator T*(), ThreadSafePointerTo< T >::p(), ThreadSafeConstPointerTo< T >::p(), and set_ptr().
|
inlinestatic |
Atomically increments the indicated variable.
Definition at line 22 of file atomicAdjustDummyImpl.I.
References dec().
Referenced by CachedTypedWritableReferenceCount::cache_ref(), NodeReferenceCount::node_ref(), NodeCachedReferenceCount::node_ref(), and ReferenceCount::ref().
|
inlinestatic |
Atomically changes the indicated variable and returns the original value.
Definition at line 56 of file atomicAdjustDummyImpl.I.
References get().
Referenced by add(), UpdateSeq::clear(), UpdateSeq::fresh(), and ConnectionReader::shutdown().
|
inlinestatic |
Atomically changes the indicated variable and returns the original value.
Definition at line 83 of file atomicAdjustDummyImpl.I.
References get_ptr().
Referenced by get().