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

  1. /*
  2. *****************************************************************************************
  3. *                                                                                       *
  4. * COPYRIGHT:                                                                            *
  5. *   (C) Copyright Taligent, Inc.,  1997                                                 *
  6. *   (C) Copyright International Business Machines Corporation,  1997-1998               *
  7. *   Licensed Material - Program-Property of IBM - All Rights Reserved.                  *
  8. *   US Government Users Restricted Rights - Use, duplication, or disclosure             *
  9. *   restricted by GSA ADP Schedule Contract with IBM Corp.                              *
  10. *                                                                                       *
  11. *****************************************************************************************
  12. */
  13.  
  14. #include "tsmutex.h"
  15. #include <stdio.h>
  16. #include <string.h>
  17.  
  18. #ifdef SOLARIS
  19. #include <signal.h>
  20. #endif
  21.  
  22. //////////////////////////
  23. //
  24. // Simple Mutex structure
  25. //   Increments lockCount each time the mutex is locked.
  26. //   Decrements lockCount each time the mutex is unlocked.
  27. //Note: This test does not actually create locks, since
  28. //that would be platform specific.  This test simply tests
  29. //the functionality of the Mutex class.
  30. //
  31. //////////////////////////
  32. #if 0
  33. struct MyMutexImp {
  34.   MyMutexImp();
  35.   uint32_t lockCount;
  36. };
  37.  
  38. MyMutexImp::MyMutexImp() {
  39.   lockCount = 0;
  40. }
  41.  
  42. static void _myLock(MutexPointer  p) {
  43.   MyMutexImp* imp = (MyMutexImp*)p;
  44.   (imp->lockCount)++; 
  45. }
  46.  
  47. static void _myUnlock(MutexPointer  p) {
  48.   MyMutexImp* imp = (MyMutexImp*)p;
  49.   (imp->lockCount)--; 
  50. }
  51. #endif
  52. //////////////////////////
  53. //
  54. // The Test Class
  55. //
  56. //////////////////////////
  57. MutexTest::MutexTest() {
  58. }
  59.  
  60. MutexTest::~MutexTest() {
  61. }
  62.  
  63. void MutexTest::runIndexedTest( int32_t index, bool_t exec, 
  64.                 char* &name, char* par ) {
  65.   if (exec) logln("TestSuite MutexTest: ");
  66.   switch (index) {
  67.   case 0: name = "TestMutex"; if (exec) TestMutex(); break;
  68.     
  69.   default: name = ""; break; //needed to end loop
  70.   }
  71. }
  72.  
  73. void MutexTest::TestMutex() {
  74. }
  75.  
  76.  
  77. void MutexTest::TestLock() {
  78.   }
  79.  
  80.  
  81.  
  82.  
  83.