OpenWalnut  1.4.0
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 261 of file WThreadedFunction_test.h.

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

Referenced by testExceptionHandling().

Exceptions should lead to the status beeing changed to W_THREADS_ABORTED.

Also, exceptions should be forwarded to the exception handler.

Definition at line 242 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().

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

Definition at line 143 of file WThreadedFunction_test.h.

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

The stop condition should be notified correctly.

Definition at line 223 of file WThreadedFunction_test.h.

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

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

Definition at line 203 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 267 of file WThreadedFunction_test.h.

Referenced by handleException(), and testExceptionHandling().


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