]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/common/umutex.h
ICU-461.12.tar.gz
[apple/icu.git] / icuSources / common / umutex.h
index 06033feb40bbd9f6867d09c7505692533acdeaac..9336fe8aa78355ecf70ee9548edcf6df86309dd1 100644 (file)
@@ -1,6 +1,6 @@
 /*
 **********************************************************************
-*   Copyright (C) 1997-2005, International Business Machines
+*   Copyright (C) 1997-2008, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 **********************************************************************
 *
 
 /**
  * \def UMTX_CHECK
- * Encapsulates a safe check for an expression (usually a condition)
- * for lazy variable inititialization.
+ * Encapsulates a safe check of an expression 
+ * for use with double-checked lazy inititialization.
  * On CPUs with weak memory models, this must use memory fence instructions
  * or mutexes.
+ * The expression must involve only a  _single_ variable, typically
+ *    a possibly null pointer or a boolean that indicates whether some service
+ *    is initialized or not.
+ * The setting of the variable involved in the test must be the last step of
+ *    the initialization process.
+ *
+ * 
  * @internal
  */
 #if UMTX_STRONG_MEMORY_MODEL
 
 #define UMTX_CHECK(pMutex, expression, result) \
-    (result)=(expression);
+    (result)=(expression)
 
 #else
 
 #define UMTX_CHECK(pMutex, expression, result) \
     umtx_lock(pMutex); \
     (result)=(expression); \
-    umtx_unlock(pMutex);
+    umtx_unlock(pMutex)
 
 #endif