Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Public Attributes
Support::ThreadPool::ThreadPoolWorker Struct Reference

#include <ThreadPool.h>

List of all members.

Public Member Functions

void operator() ()
 ThreadPoolWorker (ThreadPool &threadPool)

Public Attributes

ThreadPool_threadPool
boost::xtime _waitTimeActive
boost::xtime _waitTimeIdle

Detailed Description

Defines an object that performs work for the pool

Definition at line 61 of file Support/Include/ThreadPool.h.


Constructor & Destructor Documentation

Support::ThreadPool::ThreadPoolWorker::ThreadPoolWorker ( ThreadPool threadPool)

Member Function Documentation

void Support::ThreadPool::ThreadPoolWorker::operator() ( )

Implements the work done by a worker thread in the pool This causes them to sit in a loop and perform work off the queue

Definition at line 18 of file ThreadPool.cpp.

    {
        while(true)
        {
            //how long we wait after the task depends on if we have another
            //even if we have another, it's good to sleep to surrender the CPU from time to time
            if(_threadPool.consumeTask())
                boost::thread::sleep(_waitTimeActive);
            else
                boost::thread::sleep(_waitTimeIdle);
        }
    }

Member Data Documentation

Definition at line 63 of file Support/Include/ThreadPool.h.

Definition at line 64 of file Support/Include/ThreadPool.h.

Referenced by ThreadPoolWorker().

Definition at line 65 of file Support/Include/ThreadPool.h.

Referenced by ThreadPoolWorker().


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

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net