]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/threadtest/threadtest.h
ICU-6.2.4.tar.gz
[apple/icu.git] / icuSources / test / threadtest / threadtest.h
CommitLineData
b75a7d8f
A
1//
2//********************************************************************
3// Copyright (C) 2002, International Business Machines
4// Corporation and others. All Rights Reserved.
5//********************************************************************
6//
7// File threadtest.h
8//
9#ifndef ABSTRACTTHREADTEST_H
10#define ABSTRACTTHREADTEST_H
11//------------------------------------------------------------------------------
12//
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
18// of ICU.
19//
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
23// the test.
24//
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
27// duration.
28//
29// runOnce() will be called repeatedly by the working threads of
30// the test in the full multi-threaded environment.
31//
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.
35//
36//------------------------------------------------------------------------------
37class AbstractThreadTest {
38public:
39 AbstractThreadTest() {};
40 virtual ~AbstractThreadTest() {};
41 virtual void check() = 0;
42 virtual void runOnce() = 0;
43};
44
45#endif // ABSTRACTTHREADTEST_H
46