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 Integer | add (Integer &var, Integer delta) |
Atomically computes var += delta. | |
static Integer | compare_and_exchange (Integer &mem, Integer old_value, Integer new_value) |
Atomic compare and exchange. | |
static Pointer | compare_and_exchange_ptr (Pointer &mem, Pointer old_value, Pointer new_value) |
Atomic compare and exchange. | |
static bool | dec (Integer &var) |
Atomically decrements the indicated variable and returns true if the new value is nonzero, false if it is zero. | |
static Integer | get (const Integer &var) |
Atomically retrieves the snapshot value of the indicated variable. | |
static Pointer | get_ptr (const Pointer &var) |
Atomically retrieves the snapshot value of the indicated variable. | |
static void | inc (Integer &var) |
Atomically increments the indicated variable. | |
static Integer | set (Integer &var, Integer new_value) |
Atomically changes the indicated variable and returns the original value. | |
static Pointer | set_ptr (Pointer &var, Pointer new_value) |
Atomically changes the indicated variable and returns the original value. | |
A trivial implementation for atomic adjustments for systems that don't require multiprogramming, and therefore don't require special atomic operations.
Definition at line 27 of file atomicAdjustDummyImpl.h.
typedef long AtomicAdjustDummyImpl::Integer |
Definition at line 29 of file atomicAdjustDummyImpl.h.
typedef void* AtomicAdjustDummyImpl::Pointer |
Definition at line 30 of file atomicAdjustDummyImpl.h.
|
inlinestatic |
Atomically computes var += delta.
It is legal for delta to be negative. Returns the result of the addition.
Definition at line 35 of file atomicAdjustDummyImpl.I.
Referenced by TypeHandle::allocate_array(), TypeHandle::deallocate_array(), MemoryHook::dec_heap(), TypeHandle::dec_memory_usage(), MemoryHook::heap_alloc_array(), MemoryHook::heap_alloc_single(), MemoryHook::heap_free_array(), MemoryHook::heap_free_single(), MemoryHook::heap_realloc_array(), MemoryHook::inc_heap(), TypeHandle::inc_memory_usage(), and TypeHandle::reallocate_array().
|
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 92 of file atomicAdjustDummyImpl.I.
Referenced by DeletedBufferChain::deallocate(), ReferenceCount::ref_if_nonzero(), and ReferenceCount::unref_if_one().
|
inlinestatic |
Atomic compare and exchange.
As above, but works on pointers instead of integers.
Definition at line 108 of file atomicAdjustDummyImpl.I.
Referenced by GraphicsStateGuardianBase::add_gsg(), Filename::get_common_appdata_directory(), Filename::get_home_directory(), Filename::get_temp_directory(), Filename::get_user_appdata_directory(), and PT().
|
inlinestatic |
Atomically decrements the indicated variable and returns true if the new value is nonzero, false if it is zero.
Definition at line 26 of file atomicAdjustDummyImpl.I.
Referenced by LightLensNode::attrib_unref(), CachedTypedWritableReferenceCount::cache_unref(), AsyncGatheringFuture::cancel(), NodeReferenceCount::node_unref_only(), AsyncFuture::notify_done(), StreamWrapperBase::unref(), ReferenceCount::unref(), and WeakReferenceList::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 58 of file atomicAdjustDummyImpl.I.
Referenced by AsyncFuture::cancelled(), AsyncFuture::done(), TypeHandle::get_memory_usage(), NodeReferenceCount::get_node_ref_count(), NodeCachedReferenceCount::get_node_ref_count(), MemoryHook::heap_alloc_array(), MemoryHook::heap_alloc_single(), UpdateSeq::is_fresh(), UpdateSeq::is_initial(), UpdateSeq::is_old(), AudioLoadRequest::is_ready(), AnimateVerticesRequest::is_ready(), TextureReloadRequest::is_ready(), ModelFlattenRequest::is_ready(), ModelLoadRequest::is_ready(), ModelSaveRequest::is_ready(), UpdateSeq::is_special(), PT(), ReferenceCount::ref_if_nonzero(), DeletedBufferChain::validate(), and WeakReferenceList::was_deleted().
|
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 80 of file atomicAdjustDummyImpl.I.
Referenced by GraphicsStateGuardianBase::add_gsg(), Filename::get_common_appdata_directory(), GraphicsStateGuardianBase::get_default_gsg(), ClockObject::get_global_clock(), 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(), GraphicsStateGuardianBase::remove_gsg(), and GraphicsStateGuardianBase::set_default_gsg().
|
inlinestatic |
Atomically increments the indicated variable.
Definition at line 17 of file atomicAdjustDummyImpl.I.
Referenced by LightLensNode::attrib_ref(), CachedTypedWritableReferenceCount::cache_ref(), CachedTypedWritableReferenceCount::cache_ref_only(), AsyncGatheringFuture::cancel(), NodeReferenceCount::node_ref(), NodeCachedReferenceCount::node_ref(), StreamWrapperBase::ref(), ReferenceCount::ref(), and WeakReferenceList::ref().
|
inlinestatic |
Atomically changes the indicated variable and returns the original value.
Definition at line 45 of file atomicAdjustDummyImpl.I.
Referenced by UpdateSeq::clear().
|
inlinestatic |
Atomically changes the indicated variable and returns the original value.
Definition at line 66 of file atomicAdjustDummyImpl.I.