OLD | NEW |
(Empty) | |
| 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 p
arts |
| 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 e
nvironment, |
| 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 th
reads of |
| 30 // the test in the full multi-threaded environment. |
| 31 // |
| 32 // check() will be called periodically in a single threa
ded |
| 33 // environment, with the worker threads temporarily susp
ended between |
| 34 // between calls to runOnce(). Do consistency checks he
re. |
| 35 // |
| 36 //------------------------------------------------------------------------------ |
| 37 class AbstractThreadTest { |
| 38 public: |
| 39 AbstractThreadTest() {}; |
| 40 virtual ~AbstractThreadTest() {}; |
| 41 virtual void check() = 0; |
| 42 virtual void runOnce() = 0; |
| 43 }; |
| 44 |
| 45 #endif // ABSTRACTTHREADTEST_H |
| 46 |
OLD | NEW |