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

Unified Diff: source/i18n/rbt.cpp

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months 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 | « source/i18n/rbt.h ('k') | source/i18n/rbt_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/rbt.cpp
diff --git a/source/i18n/rbt.cpp b/source/i18n/rbt.cpp
index 5c4d3beaee5ece34a2951ef7d06b04009da29deb..1e4b593cce469959397a2d813c67960563180592 100644
--- a/source/i18n/rbt.cpp
+++ b/source/i18n/rbt.cpp
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1999-2015, International Business Machines
@@ -240,31 +242,27 @@ RuleBasedTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
// Double-locking must be prevented in these cases.
//
- // If the transliteration data is exclusively owned by this transliterator object,
- // we don't need to do any locking. No sharing between transliterators is possible,
- // so no concurrent access from multiple threads is possible.
UBool lockedMutexAtThisLevel = FALSE;
- if (isDataOwned == FALSE) {
- // Test whether this request is operating on the same text string as
- // some other transliteration that is still in progress and holding the
- // transliteration mutex. If so, do not lock the transliteration
- // mutex again.
- //
- // gLockedText variable is protected by the global ICU mutex.
- // Shared RBT data protected by transliteratorDataMutex.
- //
- // TODO(andy): Need a better scheme for handling this.
- UBool needToLock;
- {
- Mutex m;
- needToLock = (&text != gLockedText);
- }
- if (needToLock) {
- umtx_lock(&transliteratorDataMutex); // Contention, longish waits possible here.
- Mutex m;
- gLockedText = &text;
- lockedMutexAtThisLevel = TRUE;
- }
+
+ // Test whether this request is operating on the same text string as
+ // some other transliteration that is still in progress and holding the
+ // transliteration mutex. If so, do not lock the transliteration
+ // mutex again.
+ //
+ // gLockedText variable is protected by the global ICU mutex.
+ // Shared RBT data protected by transliteratorDataMutex.
+ //
+ // TODO(andy): Need a better scheme for handling this.
+ UBool needToLock;
+ {
+ Mutex m;
+ needToLock = (&text != gLockedText);
+ }
+ if (needToLock) {
+ umtx_lock(&transliteratorDataMutex); // Contention, longish waits possible here.
+ Mutex m;
+ gLockedText = &text;
+ lockedMutexAtThisLevel = TRUE;
}
// Check to make sure we don't dereference a null pointer.
« no previous file with comments | « source/i18n/rbt.h ('k') | source/i18n/rbt_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698