]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/tsmthred.h
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / test / intltest / tsmthred.h
1 /********************************************************************
2 * COPYRIGHT:
3 * Copyright (c) 1997-2003, International Business Machines Corporation and
4 * others. All Rights Reserved.
5 ********************************************************************/
6
7
8 #ifndef MULTITHREADTEST_H
9 #define MULTITHREADTEST_H
10
11 #include "intltest.h"
12 #include "mutex.h"
13
14 /*
15 Test multithreading. Of course we need a thread class first..
16 this wrapper has a ported implementation.
17 */
18
19 class SimpleThread
20 {
21 public:
22 SimpleThread();
23 virtual ~SimpleThread();
24 int32_t start(void); // start the thread
25 public: // should be private, but then we couldn't be asocial.
26 virtual void run(void) = 0; // Override this to provide some real implementation
27 private:
28 void *fImplementation;
29
30 public:
31 static void sleep(int32_t millis); // probably shouldn't go here but oh well.
32 };
33
34
35 /**
36 * Tests actual threading
37 **/
38 class MultithreadTest : public IntlTest
39 {
40 public:
41 MultithreadTest();
42 virtual ~MultithreadTest();
43
44 void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
45
46 /**
47 * test that threads even work
48 **/
49 void TestThreads(void);
50 /**
51 * test that mutexes work
52 **/
53 void TestMutex(void);
54 #if !UCONFIG_NO_FORMATTING
55 /**
56 * test that intl functions work in a multithreaded context
57 **/
58 void TestThreadedIntl(void);
59 #endif
60 void TestCollators(void);
61
62 };
63
64 #endif
65