MPMA Namespace Reference

The Base MPMA Framework. More...


Classes

class  RouterOutput
 Implementations of this are output targets which can accept debug data from a RouterInput and output it to anything it likes. More...
class  RouterInput
 The program will send it's debug data to instances of this. This will take data and marshell it to all attached outputs. More...
class  RouterOutputFile
 A simple RouterInputOutput implementation that writes output to a file (overridding the file). More...
class  RouterOutputStdout
 A simple RouterInputOutput implementation that writes output to a stdout. More...
class  Filename
 Construct this with a non-absolute filename using either windows or linux style, to generate a filename for whatever platform this is running on. Filenames that begin with ~ are relative to the users home directory. More...
class  Directory
 Represents a directory that can be browsed and navigated. More...
struct  SystemInfo
 Information about the system. These are readable anytime after init. Values which are not possible to obtain will be populated with sane defaults. More...
class  RWSleepLock
 ReaderWriter sleep-lock (re-entrant safe). Read locks don't block each other out, but Write locks are exclusive to all other locks. More...
class  TakeRWSleepLock
 Used to lock/unlock a RWSleepLock automatically using scope. The lock is released on dustruction. More...
class  MutexLock
 Mutex (re-entrant safe). More...
class  TakeMutexLock
 Used to lock/unlock a MutexLock automatically using scope. The lock is released on dustruction. More...
class  SpinLock
 Spinlock (NOT re-entrant safe) that reverts to a sleeplock on single cpu systems. If no lock-contention occurs, these is extremely little overhead in use. More...
class  TakeSpinLock
 Used to lock/unlock a spinlock automatically using scope. The lock is released on destruction. More...
class  BlockingObject
 An object that can be used to block a thread until another thread signals it to resume. More...
class  InitAndShutdown
 You MUST declare this (and only 1 of it) at the start of the scope in which you want the framework to be used. It will handle all setup and cleanup required. Most likely you want to do this at the start of main(). More...
union  ThreadParam
 A user-defined parameter passed to the thread procedure. More...
class  Thread
 Represents a thread. More...
class  ThreadPool
 A pool of pre-created threads. More...
class  Timer
 A timer. More...
class  Vary
 A variable that can have eithar an integral, real, or string type. It can convert itself between the different types. More...

Typedefs

typedef void(* ThreadFunc )(class Thread &, ThreadParam)
 A callback function for the thread's procedure. This function should monitor the IsEnding() method of the provided Thread class, and terminate if it ever returns true.

Functions

std::string GetCallStack ()
 Returns a string representing the call stack for the current thread. Note that there is a decent amount of overhead involved in this.
RouterInputErrorReport ()
 Attach outputs to this after init to recieve error messages from the framework.
void AtomicIntInc (volatile uint *pint)
 Atomically increments an integer.
void AtomicIntDec (volatile uint *pint)
 Atomically decrements an integer.
int AtomicIntAdd (volatile int *pint, int addValue)
 Atomically adds one integer to another and returns the value of the original.
bool AtomicCompareExchange (volatile uint *pInt, uint expectedValue, uint newValue, volatile uint &outResultValue)
 Compares expectedValue with the value at pInt, and if they are the same, sets pInt to newValue and returns true with outResultValue set to newValue. If they are different then pInt is unaffected, and returns false with outResultValue set to the value that was found at pInt.
void Sleep (uint time)
 Causes the current thread to block for at least time (in milliseconds). 0 just forces a yield.
template<typename FuncType, FuncType userFunc, typename UserParamType>
void ExecuteThreadedTask (uint count, UserParamType userParam)


Detailed Description

The Base MPMA Framework.

Function Documentation

template<typename FuncType, FuncType userFunc, typename UserParamType>
void MPMA::ExecuteThreadedTask ( uint  count,
UserParamType  userParam 
) [inline]

Executes a function in parallel using multiple threads (1 per cpu core). The function should take 2 parameters: a uint for the unique 0-based count index passed to it, and the user-supplied parameter. Example:
If you have a function:
inline void Foo(int i, float *param)
{
param[i]+=123.456f;
}
And you wanted to call that function 1000 times total, with i ranging from 0 to 999, you would write:
ExecuteThreadedTask<void(*)(int,float*), Foo)>(1000, myArrayOfFloats);


Generated on Sat Aug 9 15:05:10 2008 for MPMA Framework by  doxygen 1.5.6