CppAD: A C++ Algorithmic Differentiation Package  20130102
thread_alloc Class Reference

Capacity vector for memory allocation block sizes. More...

List of all members.

Classes

class  block_t
class  capacity_t
struct  thread_alloc_info
 Structure of information for each thread. More...

Static Public Member Functions

static void parallel_setup (size_t num_threads, bool(*in_parallel)(void), size_t(*thread_num)(void))
 Set thread_alloc up for parallel mode usage.
static size_t num_threads (void)
 Get the current number of threads that thread_alloc can use.
static bool in_parallel (void)
 Are we in a parallel execution state; i.e., is it possible that other threads are currently executing.
static size_t thread_num (void)
 Get current thread number.
static void * get_memory (size_t min_bytes, size_t &cap_bytes)
 Use thread_alloc to get a specified amount of memory.
static void return_memory (void *v_ptr)
 Return memory that was obtained by get_memory.
static void free_available (size_t thread)
 Return all the memory being held as available for a thread to the system.
static void hold_memory (bool value)
 Change the thread_alloc hold memory setting.
static size_t inuse (size_t thread)
 Determine the amount of memory that is currently inuse.
static size_t available (size_t thread)
 Determine the amount of memory that is currently available for use.
template<class Type >
static Type * create_array (size_t size_min, size_t &size_out)
 Use thread_alloc to allocate an array, then call default construtor for each element.
template<class Type >
static void delete_array (Type *array)
 Return Memory Used for an Array to the Available Pool (include destructor call for each element).
static bool free_all (void)
 Return to the system all thread_alloc memory that is not currently inuse.

Static Private Member Functions

static const capacity_tcapacity_info (void)
 Vector of fixed capacity values for this allocator.
static bool set_get_hold_memory (bool set, bool new_value=false)
 Set and Get hold available memory flag.
static thread_alloc_infothread_info (size_t thread, bool clear=false)
 Get pointer to the information for this thread.
static void inc_inuse (size_t inc, size_t thread)
 Increase the number of bytes of memory that are currently in use; i.e., that been obtained with get_memory and not yet returned.
static void inc_available (size_t inc, size_t thread)
 Increase the number of bytes of memory that are currently avaialble; i.e., have been obtained obtained from the system and are being held future use.
static void dec_inuse (size_t dec, size_t thread)
 Decrease the number of bytes of memory that are currently in use; i.e., that been obtained with get_memory and not yet returned.
static void dec_available (size_t dec, size_t thread)
 Decrease the number of bytes of memory that are currently avaialble; i.e., have been obtained obtained from the system and are being held future use.
static size_t set_get_num_threads (size_t number_new)
 Set and get the number of threads that are sharing memory.
static bool set_get_in_parallel (bool(*parallel_new)(void), bool set=false)
 Set and call the routine that determine if we are in parallel execution mode.
static size_t set_get_thread_num (size_t(*thread_num_new)(void), bool set=false)
 Set and call the routine that determine the current thread number.

Detailed Description

Capacity vector for memory allocation block sizes.

Only one of these objects should be created and used as a static variable inside of the thread_alloc::capacity_info function.

Allocator class that works well with an multi-threading environment.

Definition at line 83 of file thread_alloc.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines