summaryrefslogtreecommitdiff
path: root/src/corelib/codecs/qtextcodec.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-08-03 11:40:35 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-04 00:52:14 +0200
commit4e542d958a8fa81c91e55c1358e15c84e34d15de (patch)
tree0dae9c119fad275a0f3a062b1b3920edf1eda77d /src/corelib/codecs/qtextcodec.cpp
parent0715e1e6c2d38776cd9d5661639ce517f685fa6f (diff)
downloadqtbase-4e542d958a8fa81c91e55c1358e15c84e34d15de.tar.gz
ICU: Mark which functions are threadsafe and which ones aren't
Mark the thread-safe functions with the \threadsafe doc marker. This includes public API, which should be thread-safe anyway. The thread-unsafe functions are marked "\nonreentrant" already. In addition, I renamed the functions that must be called with locked mutexes to Unlocked, following the convention in other libraries like libdbus-1. Change-Id: Ibd93d1266149767f546c8e82959b73c138008469 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/codecs/qtextcodec.cpp')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 349ff0fbd1..35a430cf65 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -146,6 +146,7 @@ static QTextCodec *checkForCodec(const QByteArray &name) {
static void setup();
+// \threadsafe
// this returns the codec the method sets up as locale codec to
// avoid a race condition in codecForLocale() when
// setCodecForLocale(0) is called at the same time.
@@ -495,6 +496,7 @@ QTextCodec::~QTextCodec()
*/
/*!
+ \threadsafe
Searches all installed QTextCodec objects and returns the one
which best matches \a name; the match is case-insensitive. Returns
0 if no codec matching the name \a name could be found.
@@ -538,12 +540,13 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
return 0;
#else
- return QIcuCodec::codecForName(name);
+ return QIcuCodec::codecForNameUnlocked(name);
#endif
}
/*!
+ \threadsafe
Returns the QTextCodec which matches the
\l{QTextCodec::mibEnum()}{MIBenum} \a mib.
*/
@@ -578,13 +581,14 @@ QTextCodec* QTextCodec::codecForMib(int mib)
}
#ifdef QT_USE_ICU
- return QIcuCodec::codecForMib(mib);
+ return QIcuCodec::codecForMibUnlocked(mib);
#endif
return 0;
}
/*!
+ \threadsafe
Returns the list of all available codecs, by name. Call
QTextCodec::codecForName() to obtain the QTextCodec for the name.
@@ -616,6 +620,7 @@ QList<QByteArray> QTextCodec::availableCodecs()
}
/*!
+ \threadsafe
Returns the list of MIBs for all available codecs. Call
QTextCodec::codecForMib() to obtain the QTextCodec for the MIB.
@@ -659,6 +664,7 @@ void QTextCodec::setCodecForLocale(QTextCodec *c)
}
/*!
+ \threadsafe
Returns a pointer to the codec most suitable for this locale.
On Windows, the codec will be based on a system locale. On Unix
@@ -677,8 +683,9 @@ QTextCodec* QTextCodec::codecForLocale()
QTextCodec *codec = globalData->codecForLocale.loadAcquire();
if (!codec) {
#ifdef QT_USE_ICU
- codec = QIcuCodec::defaultCodec();
+ codec = QIcuCodec::defaultCodecUnlocked();
#else
+ // setupLocaleMapper locks as necessary
codec = setupLocaleMapper();
#endif
}