Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: icu46/source/common/mutex.cpp

Issue 5516007: Check in the pristine copy of ICU 4.6... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « icu46/source/common/mutex.h ('k') | icu46/source/common/normalizer2.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: icu46/source/common/mutex.cpp
===================================================================
--- icu46/source/common/mutex.cpp (revision 0)
+++ icu46/source/common/mutex.cpp (revision 0)
@@ -0,0 +1,91 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2008-2010, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+* file name: mutex.cpp
+* encoding: US-ASCII
+* tab size: 8 (not used)
+* indentation:4
+*/
+
+#include "unicode/utypes.h"
+#include "mutex.h"
+
+U_NAMESPACE_BEGIN
+
+void *SimpleSingleton::getInstance(InstantiatorFn *instantiator, const void *context,
+ void *&duplicate,
+ UErrorCode &errorCode) {
+ duplicate=NULL;
+ if(U_FAILURE(errorCode)) {
+ return NULL;
+ }
+ void *instance;
+ UMTX_CHECK(NULL, fInstance, instance);
+ if(instance!=NULL) {
+ return instance;
+ } else {
+ instance=instantiator(context, errorCode);
+ Mutex mutex;
+ if(fInstance==NULL && U_SUCCESS(errorCode)) {
+ fInstance=instance;
+ } else {
+ duplicate=instance;
+ }
+ return fInstance;
+ }
+}
+
+void *TriStateSingleton::getInstance(InstantiatorFn *instantiator, const void *context,
+ void *&duplicate,
+ UErrorCode &errorCode) {
+ duplicate=NULL;
+ if(U_FAILURE(errorCode)) {
+ return NULL;
+ }
+ int8_t haveInstance;
+ UMTX_CHECK(NULL, fHaveInstance, haveInstance);
+ if(haveInstance>0) {
+ return fInstance; // instance was created
+ } else if(haveInstance<0) {
+ errorCode=fErrorCode; // instance creation failed
+ return NULL;
+ } else /* haveInstance==0 */ {
+ void *instance=instantiator(context, errorCode);
+ Mutex mutex;
+ if(fHaveInstance==0) {
+ if(U_SUCCESS(errorCode)) {
+ fInstance=instance;
+ instance=NULL;
+ fHaveInstance=1;
+ } else {
+ fErrorCode=errorCode;
+ fHaveInstance=-1;
+ }
+ } else {
+ errorCode=fErrorCode;
+ }
+ duplicate=instance;
+ return fInstance;
+ }
+}
+
+void TriStateSingleton::reset() {
+ fInstance=NULL;
+ fErrorCode=U_ZERO_ERROR;
+ fHaveInstance=0;
+}
+
+#if UCONFIG_NO_SERVICE
+
+/* If UCONFIG_NO_SERVICE, then there is no invocation of Mutex elsewhere in
+ common, so add one here to force an export */
+static Mutex *aMutex = 0;
+
+/* UCONFIG_NO_SERVICE */
+#endif
+
+U_NAMESPACE_END
Property changes on: icu46/source/common/mutex.cpp
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « icu46/source/common/mutex.h ('k') | icu46/source/common/normalizer2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698