From c3d777812ce73886d095a1b1b3c5094094c818c8 Mon Sep 17 00:00:00 2001 From: schmidt Date: Wed, 9 May 2001 18:35:29 +0000 Subject: ChangeLogTag:Wed May 09 10:02:10 2001 Balachandran --- ChangeLog | 23 ++++++ ChangeLogs/ChangeLog-02a | 23 ++++++ ChangeLogs/ChangeLog-03a | 23 ++++++ TAO/ChangeLogs/ChangeLog-02a | 12 +++ TAO/orbsvcs/orbsvcs/Sched/Config_Scheduler.h | 21 ++--- THANKS | 1 + ace/OS.h | 6 +- ace/SV_Shared_Memory.h | 1 - examples/Shared_Memory/test_SV.cpp | 2 +- tests/Thread_Mutex_Test.cpp | 119 +++++++++++++++++++++++++-- 10 files changed, 207 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f981026064..9d075c8f85f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,18 +7,41 @@ Mon May 7 07:14:08 2001 Balachandran Natarajan * bin/auto_run_tests.lst: Commented out OctetSeq test from running in static configurations. +Mon May 7 06:40:44 2001 Douglas C. Schmidt + + * examples/Shared_Memory/test_SV.cpp: Cast SHM_KEY to (key_t) to + make BCB happy. Thanks to Johnny Willemsen for this. + +Sat May 5 15:30:40 2001 Douglas C. Schmidt + + * THANKS: Just added the 1,200th contributor to the ACE+TAO. + Thanks to Alexandre Cervieri + for helping us hit a new milestone! + Sat May 5 08:51:23 2001 Balachandran Natarajan * bin/nightlybuilds/builds.lst: Just commented the HP_UX builds. OCI seems to be having problems with their HP machine. We will get it online once the builds start running. +Sat May 5 08:01:30 2001 Douglas C. Schmidt + + * tests/Thread_Mutex_Test.cpp: Added a series of tests that exercise + the new functionality of the ACE_Guard. Thanks to Christopher + Kohlhoff for providing the enhancements. + Fri May 4 15:42:20 2001 Craig Rodrigues * ace/OS.h Changed ACE_SERVICETYPE_CONTROLLEDLOAD from 2 to 1 This is necessary to work with RAPI. +Fri May 4 06:28:19 2001 Douglas C. Schmidt + + * ace/OS.h: Changed the typedefs of uid_t, gid_t, and mode_t to + match those in standard POSIX. Thanks to Gonzalo Diethelm + for reporting this. + Fri May 4 06:28:19 2001 Douglas C. Schmidt * ace/ace_wchar.h: Add a new macro (ACE_USES_L_PREFIX) that allows diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 9f981026064..9d075c8f85f 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -7,18 +7,41 @@ Mon May 7 07:14:08 2001 Balachandran Natarajan * bin/auto_run_tests.lst: Commented out OctetSeq test from running in static configurations. +Mon May 7 06:40:44 2001 Douglas C. Schmidt + + * examples/Shared_Memory/test_SV.cpp: Cast SHM_KEY to (key_t) to + make BCB happy. Thanks to Johnny Willemsen for this. + +Sat May 5 15:30:40 2001 Douglas C. Schmidt + + * THANKS: Just added the 1,200th contributor to the ACE+TAO. + Thanks to Alexandre Cervieri + for helping us hit a new milestone! + Sat May 5 08:51:23 2001 Balachandran Natarajan * bin/nightlybuilds/builds.lst: Just commented the HP_UX builds. OCI seems to be having problems with their HP machine. We will get it online once the builds start running. +Sat May 5 08:01:30 2001 Douglas C. Schmidt + + * tests/Thread_Mutex_Test.cpp: Added a series of tests that exercise + the new functionality of the ACE_Guard. Thanks to Christopher + Kohlhoff for providing the enhancements. + Fri May 4 15:42:20 2001 Craig Rodrigues * ace/OS.h Changed ACE_SERVICETYPE_CONTROLLEDLOAD from 2 to 1 This is necessary to work with RAPI. +Fri May 4 06:28:19 2001 Douglas C. Schmidt + + * ace/OS.h: Changed the typedefs of uid_t, gid_t, and mode_t to + match those in standard POSIX. Thanks to Gonzalo Diethelm + for reporting this. + Fri May 4 06:28:19 2001 Douglas C. Schmidt * ace/ace_wchar.h: Add a new macro (ACE_USES_L_PREFIX) that allows diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 9f981026064..9d075c8f85f 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -7,18 +7,41 @@ Mon May 7 07:14:08 2001 Balachandran Natarajan * bin/auto_run_tests.lst: Commented out OctetSeq test from running in static configurations. +Mon May 7 06:40:44 2001 Douglas C. Schmidt + + * examples/Shared_Memory/test_SV.cpp: Cast SHM_KEY to (key_t) to + make BCB happy. Thanks to Johnny Willemsen for this. + +Sat May 5 15:30:40 2001 Douglas C. Schmidt + + * THANKS: Just added the 1,200th contributor to the ACE+TAO. + Thanks to Alexandre Cervieri + for helping us hit a new milestone! + Sat May 5 08:51:23 2001 Balachandran Natarajan * bin/nightlybuilds/builds.lst: Just commented the HP_UX builds. OCI seems to be having problems with their HP machine. We will get it online once the builds start running. +Sat May 5 08:01:30 2001 Douglas C. Schmidt + + * tests/Thread_Mutex_Test.cpp: Added a series of tests that exercise + the new functionality of the ACE_Guard. Thanks to Christopher + Kohlhoff for providing the enhancements. + Fri May 4 15:42:20 2001 Craig Rodrigues * ace/OS.h Changed ACE_SERVICETYPE_CONTROLLEDLOAD from 2 to 1 This is necessary to work with RAPI. +Fri May 4 06:28:19 2001 Douglas C. Schmidt + + * ace/OS.h: Changed the typedefs of uid_t, gid_t, and mode_t to + match those in standard POSIX. Thanks to Gonzalo Diethelm + for reporting this. + Fri May 4 06:28:19 2001 Douglas C. Schmidt * ace/ace_wchar.h: Add a new macro (ACE_USES_L_PREFIX) that allows diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 37f95526ff2..25a66b7f14d 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -267,6 +267,18 @@ Sat May 5 16:24:11 2001 Balachandran Natarajan the ACE_HAS_USING_KEYWORD macros. This should prevent compile errors in the two Lynx builds. +Sat May 5 15:23:56 2001 Douglas C. Schmidt + + * orbsvcs/orbsvcs/Sched/Config_Scheduler.h: Added + + #if ! defined (TAO_MIN_CRITICAL_PRIORITY) + #define TAO_MIN_CRITICAL_PRIORITY 0 + #endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ + + to fix a compile problem with TAO_USES_RMS_SCHEDULING is + defined. Thanks to Alexandre Cervieri + for reporting this. + Sat May 5 13:27:36 2001 Yamuna Krishnamurthy * orbsvcs/tests/AVStreams/Component_Switching/Makefile: diff --git a/TAO/orbsvcs/orbsvcs/Sched/Config_Scheduler.h b/TAO/orbsvcs/orbsvcs/Sched/Config_Scheduler.h index 2998cbc5e59..aca68a7f3e5 100644 --- a/TAO/orbsvcs/orbsvcs/Sched/Config_Scheduler.h +++ b/TAO/orbsvcs/orbsvcs/Sched/Config_Scheduler.h @@ -131,31 +131,28 @@ private: typedef ACE_MUF_Scheduler_Strategy Scheduler_Strategy; #elif defined (TAO_USES_MLF_SCHEDULING) - - #if ! defined (TAO_MIN_CRITICAL_PRIORITY) - #define TAO_MIN_CRITICAL_PRIORITY 0 - #endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ - +# if ! defined (TAO_MIN_CRITICAL_PRIORITY) +# define TAO_MIN_CRITICAL_PRIORITY 0 +# endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ typedef ACE_MLF_Scheduler_Strategy Scheduler_Strategy; #elif defined (TAO_USES_EDF_SCHEDULING) - #if ! defined (TAO_MIN_CRITICAL_PRIORITY) - #define TAO_MIN_CRITICAL_PRIORITY 0 - #endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ - +# if ! defined (TAO_MIN_CRITICAL_PRIORITY) +# define TAO_MIN_CRITICAL_PRIORITY 0 +# endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ typedef ACE_EDF_Scheduler_Strategy Scheduler_Strategy; #elif defined (TAO_USES_RMS_SCHEDULING) - +# if ! defined (TAO_MIN_CRITICAL_PRIORITY) +# define TAO_MIN_CRITICAL_PRIORITY 0 +# endif /* ! defined (TAO_MIN_CRITICAL_PRIORITY) */ typedef ACE_RMS_Scheduler_Strategy Scheduler_Strategy; #elif defined (TAO_USES_CRITICALITY_SCHEDULING) - typedef ACE_Criticality_Scheduler_Strategy Scheduler_Strategy; #else - #error scheduling strategy must be defined #endif /* defined (TAO_USES_MUF_SCHEDULING) */ diff --git a/THANKS b/THANKS index 8f80ca2f1db..b17df77eb11 100644 --- a/THANKS +++ b/THANKS @@ -1225,6 +1225,7 @@ Richard Hardgrave Mark Drijver Guy Bolton King Carlton Teel +Alexandre Cervieri I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/OS.h b/ace/OS.h index 654b945da0e..87f04e5817a 100644 --- a/ace/OS.h +++ b/ace/OS.h @@ -3394,10 +3394,10 @@ typedef pace_gid_t gid_t; # else /* !ACE_HAS_PACE */ typedef DWORD nlink_t; # if !defined(__MINGW32__) -typedef int mode_t; +typedef u_short mode_t; # endif /* !__MINGW32__ */ -typedef int uid_t; -typedef int gid_t; +typedef long uid_t; +typedef long gid_t; # endif /* ACE_HAS_PACE */ # endif /* __BORLANDC__ */ typedef char *caddr_t; diff --git a/ace/SV_Shared_Memory.h b/ace/SV_Shared_Memory.h index cc1fa50d90f..b27404cc86e 100644 --- a/ace/SV_Shared_Memory.h +++ b/ace/SV_Shared_Memory.h @@ -1,6 +1,5 @@ /* -*- C++ -*- */ - //============================================================================= /** * @file SV_Shared_Memory.h diff --git a/examples/Shared_Memory/test_SV.cpp b/examples/Shared_Memory/test_SV.cpp index 4797dcacde8..f341f976639 100644 --- a/examples/Shared_Memory/test_SV.cpp +++ b/examples/Shared_Memory/test_SV.cpp @@ -6,7 +6,7 @@ ACE_RCSID(Shared_Memory, test_SV, "$Id$") #define SHMSZ 27 -#define SHM_KEY 5678 +#define SHM_KEY (key_t) 5678 static void client (void) diff --git a/tests/Thread_Mutex_Test.cpp b/tests/Thread_Mutex_Test.cpp index 821cac7e9e6..e68d16ff1e5 100644 --- a/tests/Thread_Mutex_Test.cpp +++ b/tests/Thread_Mutex_Test.cpp @@ -9,9 +9,9 @@ // Thread_Mutex_Test.cpp // // = DESCRIPTION -// This is a simple test to illustrate the functionality of -// ACE_Thread_Mutex. The test acquires and releases mutexes. No -// command line arguments are needed to run the test. +// This test illustrates the functionality of the +// ACE_Thread_Mutex. The test acquires and releases mutexes. No +// command line arguments are needed to run the test. // // = AUTHOR // Prashant Jain and Doug Schmidt @@ -36,11 +36,8 @@ ACE_RCSID(tests, Thread_Mutex_Test, "$Id$") #endif #if !defined (ACE_HAS_MUTEX_TIMEOUTS) - static int reported_notsup = 0; - -#endif - +#endif /* ACE_HAS_MUTEX_TIMEOUTS */ static void * test (void *args) @@ -124,6 +121,114 @@ test (void *args) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) = released on iteration %d\n"), i)); + + // Basic ACE_Guard usage - automatically acquire the mutex on + // guard construction and automatically release it on + // destruction. + { + // Construct an ACE_Guard to implicitly acquire the mutex. + ACE_Guard guard (*mutex); + ACE_ASSERT (guard.locked () != 0); + + // Perform some operation which might exit the current scope + // prematurely, e.g. by returning or throwing an exception. + // ... + + // ACE_Guard object is destroyed when exiting scope and guard + // destructor automatically releases mutex. + } + + // Use an ACE_Guard to automatically acquire a mutex, but release + // the mutex early. + { + // Construct an ACE_Guard to implicitly acquire the mutex. + ACE_Guard guard (*mutex); + ACE_ASSERT (guard.locked () != 0); + + // Perform some operation which might exit the current scope + // prematurely, e.g. by returning or throwing an exception. + // ... + + // Release the mutex since we no longer need it. + guard.release (); + ACE_ASSERT (guard.locked () == 0); + + // Do something else which does not require the mutex to be locked. + // ... + + // ACE_Guard object's destructor will not release the mutex. + } + + // Use an ACE_Guard to automatically acquire a mutex, but + // relinquish ownership of the lock so that the mutex is not + // automatically released on guard destruction. This is useful + // when an operation might not release the mutex in some + // conditions, in which case responsibility for releasing it is + // passed to someone else. + { + // Construct an ACE_Guard to implicitly acquire the mutex. + ACE_Guard guard (*mutex); + ACE_ASSERT (guard.locked () != 0); + + // Perform some operation which might exit the current scope + // prematurely, e.g. by returning or throwing an exception. + // ... + + // Relinquish ownership of the mutex lock. Someone else must + // now release it. + guard.disown (); + ACE_ASSERT (guard.locked () == 0); + + // ACE_Guard object's destructor will not release the mutex. + } + // We are now responsible for releasing the mutex. + result = mutex->release (); + ACE_ASSERT (result == 0); + + // Construct an ACE_Guard without automatically acquiring the lock. + { + // Construct an ACE_Guard object without automatically + // acquiring the mutex or taking ownership of an existing + // lock. The third parameter tells the guard that the mutex + // has not been locked. + ACE_Guard guard (*mutex, 0, 0); + ACE_ASSERT (guard.locked () == 0); + + // Conditionally acquire the mutex. + if (i % 2 == 0) + { + guard.acquire (); + ACE_ASSERT (guard.locked () != 0); + } + + // Perform some operation that might exit the current scope + // prematurely, e.g. by returning or throwing an exception. + // ... + + // ACE_Guard object is destroyed when exiting scope and guard + // destructor automatically releases if it was acquired above. + } + + // Use an ACE_Guard to take ownership of a previously acquired + // mutex. + timeout = ACE_OS::gettimeofday (); + timeout += delta; // Must pass absolute time to acquire(). + if (mutex->acquire (timeout) == 0) + { + // Construct an ACE_Guard object without automatically + // acquiring the mutex, but instead take ownership of the + // existing lock. The third parameter tells the guard that + // the mutex has already been locked. + ACE_Guard guard (*mutex, 0, 1); + ACE_ASSERT (guard.locked () != 0); + + // Perform some operation which might exit the current scope + // prematurely, e.g. by returning or throwing an exception. + // ... + + // ACE_Guard object is destroyed when exiting scope and guard + // destructor automatically releases mutex. + } } return 0; -- cgit v1.2.1