OpenWalnut 1.2.5
Classes | Public Member Functions | Private Member Functions | Private Attributes

WThreadedFunctionTest Class Reference

Tests the WThreadedFunction class. More...

#include <WThreadedFunction_test.h>

Inheritance diagram for WThreadedFunctionTest:

List of all members.

Classes

class  ExceptionalFuncType
 A function that throws exceptions. More...
class  FuncType
 A threaded function. More...

Public Member Functions

void testMultipleThreads ()
 A function computed by multiple threads should correctly set its status and compute the correct results.
void testStopThreads ()
 Status should be set correctly when threads are ordered to stop.
void testStopCondition ()
 The stop condition should be notified correctly.
void testExceptionHandling ()
 Exceptions should lead to the status beeing changed to W_THREADS_ABORTED.

Private Member Functions

void handleException (WException const &)
 Exception callback.

Private Attributes

WSharedObject< int > m_exceptionCounter
 a counter

Detailed Description

Tests the WThreadedFunction class.

Definition at line 40 of file WThreadedFunction_test.h.


Member Function Documentation

void WThreadedFunctionTest::handleException ( WException const &  ) [inline, private]

Exception callback.

Definition at line 262 of file WThreadedFunction_test.h.

References WSharedObject< T >::getWriteTicket(), and m_exceptionCounter.

Referenced by testExceptionHandling().

void WThreadedFunctionTest::testExceptionHandling ( ) [inline]

Exceptions should lead to the status beeing changed to W_THREADS_ABORTED.

Also, exceptions should be forwarded to the exception handler.

Definition at line 243 of file WThreadedFunction_test.h.

References WSharedObject< T >::getReadTicket(), WSharedObject< T >::getWriteTicket(), handleException(), m_exceptionCounter, WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), WThreadedFunctionBase::subscribeExceptionSignal(), and WThreadedFunction< Function_T >::wait().

void WThreadedFunctionTest::testMultipleThreads ( ) [inline]

A function computed by multiple threads should correctly set its status and compute the correct results.

Definition at line 144 of file WThreadedFunction_test.h.

References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), and WThreadedFunction< Function_T >::wait().

void WThreadedFunctionTest::testStopCondition ( ) [inline]

The stop condition should be notified correctly.

Definition at line 224 of file WThreadedFunction_test.h.

References WThreadedFunctionBase::getThreadsDoneCondition(), WThreadedFunction< Function_T >::run(), and WThreadedFunctionBase::status().

void WThreadedFunctionTest::testStopThreads ( ) [inline]

Status should be set correctly when threads are ordered to stop.

Definition at line 204 of file WThreadedFunction_test.h.

References WThreadedFunction< Function_T >::run(), WThreadedFunctionBase::status(), WThreadedFunction< Function_T >::stop(), and WThreadedFunction< Function_T >::wait().


Member Data Documentation

a counter

Definition at line 268 of file WThreadedFunction_test.h.

Referenced by handleException(), and testExceptionHandling().


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