2000-01-15 02:00:06 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2001-03-21 20:09:56 +00:00
|
|
|
* Copyright (c) 1997-2001, International Business Machines Corporation and
|
2000-01-15 02:00:06 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#ifndef MULTITHREADTEST_H
|
|
|
|
#define MULTITHREADTEST_H
|
|
|
|
|
1999-08-16 21:50:52 +00:00
|
|
|
#include "intltest.h"
|
|
|
|
#include "mutex.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
Test multithreading. Of course we need a thread class first..
|
|
|
|
this wrapper has a ported implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class SimpleThread
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SimpleThread();
|
|
|
|
virtual ~SimpleThread();
|
|
|
|
void start(void); // start the thread
|
|
|
|
public: // should be private, but then we couldn't be asocial.
|
|
|
|
virtual void run(void) = 0; // Override this to provide some real implementation
|
|
|
|
private:
|
|
|
|
void *fImplementation;
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void sleep(int32_t millis); // probably shouldn't go here but oh well.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tests actual threading
|
|
|
|
**/
|
|
|
|
class MultithreadTest : public IntlTest
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MultithreadTest();
|
2000-12-09 03:17:45 +00:00
|
|
|
virtual ~MultithreadTest();
|
1999-08-16 21:50:52 +00:00
|
|
|
|
2000-08-14 21:42:36 +00:00
|
|
|
void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
|
1999-08-16 21:50:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* test that threads even work
|
|
|
|
**/
|
|
|
|
void TestThreads(void);
|
|
|
|
/**
|
|
|
|
* test that mutexes work
|
|
|
|
**/
|
|
|
|
void TestMutex(void);
|
|
|
|
/**
|
|
|
|
* test that intl functions work in a multithreaded context
|
|
|
|
**/
|
|
|
|
void TestThreadedIntl(void);
|
|
|
|
};
|
|
|
|
|
2001-08-31 18:02:09 +00:00
|
|
|
#endif
|
1999-08-16 21:50:52 +00:00
|
|
|
|