Panda3D
Public Types | Static Public Member Functions | List of all members
AtomicAdjustDummyImpl Class Reference

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. 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...
 

Detailed Description

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.

Member Function Documentation

◆ add()

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::add ( AtomicAdjustDummyImpl::Integer &  var,
AtomicAdjustDummyImpl::Integer  delta 
)
inlinestatic

Atomically computes var += delta.

It is legal for delta to be negative. Returns the result of the addition.

Definition at line 36 of file atomicAdjustDummyImpl.I.

Referenced by MemoryHook::dec_heap(), TypeHandle::dec_memory_usage(), MemoryHook::inc_heap(), and TypeHandle::inc_memory_usage().

◆ compare_and_exchange()

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::compare_and_exchange ( AtomicAdjustDummyImpl::Integer &  mem,
AtomicAdjustDummyImpl::Integer  old_value,
AtomicAdjustDummyImpl::Integer  new_value 
)
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 93 of file atomicAdjustDummyImpl.I.

Referenced by ReferenceCount::ref_if_nonzero().

◆ compare_and_exchange_ptr()

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::compare_and_exchange_ptr ( AtomicAdjustDummyImpl::Pointer &  mem,
AtomicAdjustDummyImpl::Pointer  old_value,
AtomicAdjustDummyImpl::Pointer  new_value 
)
inlinestatic

Atomic compare and exchange.

As above, but works on pointers instead of integers.

Definition at line 109 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().

◆ dec()

bool AtomicAdjustDummyImpl::dec ( AtomicAdjustDummyImpl::Integer &  var)
inlinestatic

Atomically decrements the indicated variable and returns true if the new value is nonzero, false if it is zero.

Definition at line 27 of file atomicAdjustDummyImpl.I.

Referenced by LightLensNode::attrib_unref(), WeakReferenceList::unref(), and StreamWrapperBase::unref().

◆ get()

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::get ( const Integer &  var)
inlinestatic

◆ get_ptr()

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::get_ptr ( const Pointer &  var)
inlinestatic

◆ inc()

void AtomicAdjustDummyImpl::inc ( AtomicAdjustDummyImpl::Integer &  var)
inlinestatic

Atomically increments the indicated variable.

Definition at line 18 of file atomicAdjustDummyImpl.I.

Referenced by LightLensNode::attrib_ref(), AsyncGatheringFuture::cancel(), WeakReferenceList::ref(), and StreamWrapperBase::ref().

◆ set()

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::set ( AtomicAdjustDummyImpl::Integer &  var,
AtomicAdjustDummyImpl::Integer  new_value 
)
inlinestatic

Atomically changes the indicated variable and returns the original value.

Definition at line 46 of file atomicAdjustDummyImpl.I.

Referenced by UpdateSeq::clear().

◆ set_ptr()

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::set_ptr ( AtomicAdjustDummyImpl::Pointer &  var,
AtomicAdjustDummyImpl::Pointer  new_value 
)
inlinestatic

Atomically changes the indicated variable and returns the original value.

Definition at line 67 of file atomicAdjustDummyImpl.I.


The documentation for this class was generated from the following files: