Panda3D
Public Types | Static Public Member Functions
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"

List of all members.

Public Types

typedef long Integer
typedef void * Pointer

Static Public Member Functions

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

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 29 of file atomicAdjustDummyImpl.h.


Member Function Documentation

void AtomicAdjustDummyImpl::add ( AtomicAdjustDummyImpl::Integer &  var,
AtomicAdjustDummyImpl::Integer  delta 
) [inline, static]

Atomically computes var += delta.

It is legal for delta to be negative.

Definition at line 45 of file atomicAdjustDummyImpl.I.

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::compare_and_exchange ( AtomicAdjustDummyImpl::Integer &  mem,
AtomicAdjustDummyImpl::Integer  old_value,
AtomicAdjustDummyImpl::Integer  new_value 
) [inline, static]

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.

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::compare_and_exchange_ptr ( AtomicAdjustDummyImpl::Pointer &  mem,
AtomicAdjustDummyImpl::Pointer  old_value,
AtomicAdjustDummyImpl::Pointer  new_value 
) [inline, static]

Atomic compare and exchange.

As above, but works on pointers instead of integers.

Definition at line 133 of file atomicAdjustDummyImpl.I.

bool AtomicAdjustDummyImpl::dec ( AtomicAdjustDummyImpl::Integer &  var) [inline, static]

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.

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::get ( const Integer &  var) [inline, static]

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.

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::get_ptr ( const Pointer &  var) [inline, static]

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.

void AtomicAdjustDummyImpl::inc ( AtomicAdjustDummyImpl::Integer &  var) [inline, static]

Atomically increments the indicated variable.

Definition at line 22 of file atomicAdjustDummyImpl.I.

AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::set ( AtomicAdjustDummyImpl::Integer &  var,
AtomicAdjustDummyImpl::Integer  new_value 
) [inline, static]

Atomically changes the indicated variable and returns the original value.

Definition at line 56 of file atomicAdjustDummyImpl.I.

AtomicAdjustDummyImpl::Pointer AtomicAdjustDummyImpl::set_ptr ( AtomicAdjustDummyImpl::Pointer &  var,
AtomicAdjustDummyImpl::Pointer  new_value 
) [inline, static]

Atomically changes the indicated variable and returns the original value.

Definition at line 83 of file atomicAdjustDummyImpl.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations