Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | List of all members
Mezzanine::Threading::MonopolyWorkUnit Class Referenceabstract

A kind of workunit given exclusive runtime so it can consume time on multiple threads. More...

#include <monopoly.h>

+ Inheritance diagram for Mezzanine::Threading::MonopolyWorkUnit:
+ Collaboration diagram for Mezzanine::Threading::MonopolyWorkUnit:

Public Member Functions

virtual ~MonopolyWorkUnit ()
 A virtual destructor, currently empty.
 
virtual void UseThreads (const Whole &AmountToUse)=0
 Provides a hint to the monopoly as to how many threads it should use. More...
 
virtual Whole UsingThreadCount ()=0
 Retrieves the amount of threads that the monopoly will actually use. More...
 
- Public Member Functions inherited from Mezzanine::Threading::DefaultWorkUnit
 DefaultWorkUnit ()
 Simple constructor.
 
virtual ~DefaultWorkUnit ()
 Virtual destructor, doesn't actually do much.
 
virtual void AddDependency (iWorkUnit *NewDependency)
 Force this WorkUnit to Start after another has completed. More...
 
virtual void ClearDependencies ()
 Drop any information about what work units this one depends on.
 
virtual iWorkUnitGetDependency (Whole Index) const
 This is used to iterate of all the dependencies. More...
 
virtual Whole GetDependencyCount () const
 How many other WorkUnits does this one depend on? More...
 
virtual Whole GetDependentCount (FrameScheduler &SchedulerToCount)
 This returns the count workunits that depend on this work unit. More...
 
virtual Whole GetImmediateDependencyCount () const
 Get the amount of dependencies that directly count on this for access purposes. More...
 
virtual Whole GetPerformance () const
 Get the internal rolling average for querying. More...
 
virtual RollingAverage< Whole > & GetPerformanceLog ()
 Get the internal rolling average for querying. More...
 
virtual RunningState GetRunningState () const
 Retrieves the current RunningState of the thread. More...
 
virtual WorkUnitKey GetSortingKey (FrameScheduler &SchedulerToCount)
 Get the sorting metadata. More...
 
virtual bool IsEveryDependencyComplete ()
 Check if this WorkUnit could concievably run right now. More...
 
virtual void operator() (DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
 This does everything required to track metadata and log work. More...
 
virtual void PrepareForNextFrame ()
 This resets the running state and takes any further action required to use the WorkUnit again.
 
virtual void RemoveDependency (iWorkUnit *RemoveDependency)
 Remove a dependency. More...
 
virtual RunningState TakeOwnerShip ()
 Attempts to atomically start the work unit in the current thread. More...
 
- Public Member Functions inherited from Mezzanine::Threading::iWorkUnit
virtual ~iWorkUnit ()
 Virtual destructor.
 
virtual void DoWork (DefaultThreadSpecificStorage::Type &CurrentThreadStorage)=0
 WorkUnits Must implement these to do the work.
 

Additional Inherited Members

- Protected Attributes inherited from Mezzanine::Threading::DefaultWorkUnit
Int32 CurrentRunningState
 This controls do work with this after it has.
 
std::vector< iWorkUnit * > Dependencies
 A collection of of workunits that must be complete before this one can start.
 
DefaultRollingAverage< Whole >::Type PerformanceLog
 A rolling average of execution times.
 

Detailed Description

A kind of workunit given exclusive runtime so it can consume time on multiple threads.

A FrameScheduler executes monopolies before other and will allow them to run with on every thread.

Definition at line 62 of file monopoly.h.

Member Function Documentation

virtual void Mezzanine::Threading::MonopolyWorkUnit::UseThreads ( const Whole AmountToUse)
pure virtual

Provides a hint to the monopoly as to how many threads it should use.

Parameters
AmountToUseThe amount of threads you would like the monopoly to consume.

Implemented in Mezzanine::Physics::SimulationMonopolyWorkUnit, and Mezzanine::Graphics::RenderWorkUnit.

virtual Whole Mezzanine::Threading::MonopolyWorkUnit::UsingThreadCount ( )
pure virtual

Retrieves the amount of threads that the monopoly will actually use.

The monopoly is free to ignore any value passed UseThreads and use any heuristic or threading model instead.

Returns
A whole with the amount of threads to be used.

Implemented in Mezzanine::Physics::SimulationMonopolyWorkUnit, and Mezzanine::Graphics::RenderWorkUnit.


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