From 4e542d958a8fa81c91e55c1358e15c84e34d15de Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 3 Aug 2012 11:40:35 +0200 Subject: 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 --- src/corelib/codecs/qicucodec.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/corelib/codecs/qicucodec.cpp') diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp index 221d130321..b591a3d50d 100644 --- a/src/corelib/codecs/qicucodec.cpp +++ b/src/corelib/codecs/qicucodec.cpp @@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE -extern QMutex *qTextCodecsMutex(); - static void qIcuCodecStateFree(QTextCodec::ConverterState *state) { ucnv_close(static_cast(state->d)); @@ -376,7 +374,7 @@ static QTextCodec *loadQtCodec(const char *name) return 0; } - +/// \threadsafe QList QIcuCodec::availableCodecs() { QList codecs; @@ -412,6 +410,7 @@ QList QIcuCodec::availableCodecs() return codecs; } +/// \threadsafe QList QIcuCodec::availableMibs() { QList mibs; @@ -424,7 +423,7 @@ QList QIcuCodec::availableMibs() return mibs; } -QTextCodec *QIcuCodec::defaultCodec() +QTextCodec *QIcuCodec::defaultCodecUnlocked() { QCoreGlobalData *globalData = QCoreGlobalData::instance(); if (!globalData) @@ -438,13 +437,13 @@ QTextCodec *QIcuCodec::defaultCodec() #else const char *name = ucnv_getDefaultName(); #endif - c = codecForName(name); + c = codecForNameUnlocked(name); globalData->codecForLocale.storeRelease(c); return c; } -QTextCodec *QIcuCodec::codecForName(const char *name) +QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name) { // backwards compatibility with Qt 4.x if (!qstrcmp(name, "CP949")) @@ -525,11 +524,11 @@ QTextCodec *QIcuCodec::codecForName(const char *name) } -QTextCodec *QIcuCodec::codecForMib(int mib) +QTextCodec *QIcuCodec::codecForMibUnlocked(int mib) { for (int i = 0; i < mibToNameSize; ++i) { if (mibToName[i].mib == mib) - return codecForName(mibToNameTable + mibToName[i].index); + return codecForNameUnlocked(mibToNameTable + mibToName[i].index); } return 0; } -- cgit v1.2.3