]>
git.saurik.com Git - apple/icu.git/blob - icuSources/test/threadtest/threadtest.h
2 //********************************************************************
3 // Copyright (C) 2002-2011, International Business Machines
4 // Corporation and others. All Rights Reserved.
5 //********************************************************************
9 #ifndef ABSTRACTTHREADTEST_H
10 #define ABSTRACTTHREADTEST_H
11 //------------------------------------------------------------------------------
13 // class AbstractThreadTest Base class for threading tests.
14 // Use of this abstract base isolates the part of the
15 // program that nows how to spin up and control threads
16 // from the specific stuff being tested, and (hopefully)
17 // simplifies adding new threading tests for different parts
20 // Derived classes: A running test will have exactly one instance of a
21 // derived class, which will persist for the duration of the
22 // test and be shared among all of the threads involved in
25 // The constructor will be called in a single-threaded environment,
26 // and should set up any data that will need to persist for the
29 // runOnce() will be called repeatedly by the working threads of
30 // the test in the full multi-threaded environment.
32 // check() will be called periodically in a single threaded
33 // environment, with the worker threads temporarily suspended between
34 // between calls to runOnce(). Do consistency checks here.
36 //------------------------------------------------------------------------------
37 class AbstractThreadTest
{
39 AbstractThreadTest() {};
40 virtual ~AbstractThreadTest();
41 virtual void check() = 0;
42 virtual void runOnce() = 0;
45 #endif // ABSTRACTTHREADTEST_H