File: threadtest.h

package info (click to toggle)
icu 4.4.1-8%2Bsqueeze2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 84,824 kB
  • ctags: 38,703
  • sloc: cpp: 277,524; ansic: 186,015; xml: 8,983; makefile: 5,343; perl: 4,159; sh: 3,749; python: 286; sed: 33
file content (46 lines) | stat: -rw-r--r-- 2,104 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
//********************************************************************
//   Copyright (C) 2002, International Business Machines
//   Corporation and others.  All Rights Reserved.
//********************************************************************
//
// File threadtest.h
//
#ifndef ABSTRACTTHREADTEST_H
#define ABSTRACTTHREADTEST_H
//------------------------------------------------------------------------------
//
//   class AbstractThreadTest    Base class for threading tests.
//                         Use of this abstract base isolates the part of the
//                         program that nows how to spin up and control threads
//                         from the specific stuff being tested, and (hopefully)
//                         simplifies adding new threading tests for different parts
//                         of ICU.
//
//     Derived classes:    A running test will have exactly one instance of a
//                         derived class, which will persist for the duration of the
//                         test and be shared among all of the threads involved in
//                         the test.
//
//                         The constructor will be called in a single-threaded environment,
//                         and should set up any data that will need to persist for the
//                         duration.
//
//                         runOnce() will be called repeatedly by the working threads of
//                         the test in the full multi-threaded environment.
//
//                         check() will be called periodically in a single threaded
//                         environment, with the worker threads temporarily suspended between
//                         between calls to runOnce().  Do consistency checks here.
//
//------------------------------------------------------------------------------
class AbstractThreadTest {
public:
                     AbstractThreadTest() {};
    virtual         ~AbstractThreadTest() {};
    virtual void     check()   = 0;
    virtual void     runOnce() = 0;
};

#endif // ABSTRACTTHREADTEST_H