home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / tsmthred.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-16  |  1.8 KB  |  64 lines

  1. /*
  2. *****************************************************************************************
  3. *                                                                                       *
  4. * COPYRIGHT:                                                                            *
  5. *   (C) Copyright International Business Machines Corporation,  1998                    *
  6. *   Licensed Material - Program-Property of IBM - All Rights Reserved.                  *
  7. *   US Government Users Restricted Rights - Use, duplication, or disclosure             *
  8. *   restricted by GSA ADP Schedule Contract with IBM Corp.                              *
  9. *                                                                                       *
  10. *****************************************************************************************
  11. */
  12.  
  13. #include "intltest.h"
  14. #include "mutex.h"
  15.  
  16. /*
  17.     Test multithreading.   Of course we need a thread class first..
  18.     this wrapper has a ported implementation.
  19.  */
  20.  
  21. class SimpleThread
  22. {
  23. public:
  24.     SimpleThread();
  25.     virtual ~SimpleThread();
  26.     void start(void); // start the thread
  27. public: // should be private, but then we couldn't be asocial.
  28.     virtual void run(void) = 0; // Override this to provide some real implementation
  29. private:
  30.     void *fImplementation;
  31.  
  32. public:
  33.     static void sleep(int32_t millis); // probably shouldn't go here but oh well. 
  34. };
  35.  
  36.  
  37. /**
  38.  * Tests actual threading
  39.  **/
  40. class MultithreadTest : public IntlTest
  41. {
  42. public:
  43.     MultithreadTest();
  44.     ~MultithreadTest();
  45.     
  46.     void runIndexedTest( int32_t index, bool_t exec, char* &name, char* par = NULL );
  47.  
  48.     /**
  49.      * test that threads even work
  50.      **/
  51.     void TestThreads(void);
  52.     /**
  53.      * test that mutexes work 
  54.      **/
  55.     void TestMutex(void);
  56.     /**
  57.      * test that intl functions work in a multithreaded context
  58.      **/
  59.     void TestThreadedIntl(void);
  60. };
  61.  
  62.  
  63.  
  64.