]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/lock: improve a comment and review comment
authorVMware, Inc <>
Mon, 26 Jul 2010 19:09:10 +0000 (12:09 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 26 Jul 2010 19:09:10 +0000 (12:09 -0700)
Improve a review comment. One review comment from the
ulRec.c change can be propogated to the other objects.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/lock/ulExcl.c
open-vm-tools/lib/lock/ulRW.c
open-vm-tools/lib/lock/ulRec.c
open-vm-tools/lib/lock/ulSema.c
open-vm-tools/lib/lock/ulStats.c

index 7c76fee3282f3917de297118d71b4a2617c23915..99d1475124d55f66e63f2c5a233fa158434348ea 100644 (file)
@@ -201,17 +201,15 @@ MXUser_CreateExclLock(const char *userName,  // IN:
    lock->header.identifier = MXUserAllocID();
 
    stats = Util_SafeCalloc(1, sizeof(*stats));
+
+   MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
+   MXUserBasicStatsSetUp(&stats->heldStats, MXUSER_STAT_CLASS_HELD);
 #else
    stats = NULL;
 #endif
 
    Atomic_WritePtr(&lock->statsMem, stats);
 
-   if (stats) {
-      MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
-      MXUserBasicStatsSetUp(&stats->heldStats, MXUSER_STAT_CLASS_HELD);
-   }
-
    MXUserAddToList(&lock->header);
 
    return lock;
index 94a481b2e18bf14adc33a6b0357d4159210db095..c9f5b7f02c8f8625ab5964aa5332265d9076b97d 100644 (file)
@@ -460,16 +460,14 @@ MXUser_CreateRWLock(const char *userName,  // IN:
       lock->header.statsFunc = MXUserStatsActionRW;
       lock->header.identifier = MXUserAllocID();
 
-     stats = Util_SafeCalloc(1, sizeof(*stats));
+      stats = Util_SafeCalloc(1, sizeof(*stats));
+
+      MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
+      MXUserBasicStatsSetUp(&stats->heldStats, MXUSER_STAT_CLASS_HELD);
 #else
-     stats = NULL;
+      stats = NULL;
 #endif
 
-      if (stats) {
-         MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
-         MXUserBasicStatsSetUp(&stats->heldStats, MXUSER_STAT_CLASS_HELD);
-      }
-
       MXUserAddToList(&lock->header);
    } else {
       free(properName);
index 87c2be922037394df1ed3b813d92e2e30f67bf09..2c25215f3c18efc821fb13dfdf3b5bce9cdbea94 100644 (file)
@@ -173,7 +173,8 @@ MXUserDumpRecLock(MXUserHeader *header)  // IN:
  * MXUser_CreateRecLockEx --
  *
  *      Create a recursive lock specifying if the lock must always be
- *      silent - never logging any messages.
+ *      silent - never logging any messages. Silent locks will never
+ *      produce any statistics, amongst the other aspect of "silent".
  *
  *      Only the owner (thread) of a recursive lock may recurse on it.
  *
index 493cfb6787eb9fa27d05d07052dcb68816e4898c..075e0d9242374467ae02960ae00648af7ff8e56d 100644 (file)
@@ -524,16 +524,14 @@ MXUser_CreateSemaphore(const char *userName,  // IN:
       sema->header.identifier = MXUserAllocID();
 
       stats = Util_SafeCalloc(1, sizeof(*stats));
+
+      MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
 #else
       stats = NULL;
 #endif
 
       Atomic_WritePtr(&sema->statsMem, stats);
 
-      if (stats) {
-         MXUserAcquisitionStatsSetUp(&stats->acquisitionStats);
-      }
-
       MXUserAddToList(&sema->header);
    } else {
       free(properName);
index 0f62194f426fe16a7db2297cf865433e0c48d853..2f3d3d8ff73aae76da13cdc6c24a9fff4cdd92f0 100644 (file)
@@ -868,7 +868,7 @@ MXUser_PerLockData(void)
 uint32
 MXUserAllocID(void)
 {
-   static Atomic_uint32 firstFreeID = { 0 };
+   static Atomic_uint32 firstFreeID = { 1 };  // must start not zero
 
    return Atomic_FetchAndInc(&firstFreeID);
 }