diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-02 15:04:15 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-10-02 17:24:58 +0000 |
commit | 925d6eff3e8e5bc801210a67ec4cf1d4b3492fc2 (patch) | |
tree | a03f381e4823e29b2e50c1a80588f06e450656fc /src/corelib/thread/qmutex.cpp | |
parent | a3292031295a09e5e959141db78c2310e08562ae (diff) | |
parent | d0eaa737e10aed34c09ba753e21c3e027b5ce58c (diff) |
Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6
Diffstat (limited to 'src/corelib/thread/qmutex.cpp')
-rw-r--r-- | src/corelib/thread/qmutex.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index 3269ee3ae8..742a572bef 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -571,19 +571,26 @@ FreeList *freelist() return &list; } #else +static QBasicAtomicPointer<FreeList> freeListPtr; + FreeList *freelist() { - static QAtomicPointer<FreeList> list; - FreeList *local = list.loadAcquire(); + FreeList *local = freeListPtr.loadAcquire(); if (!local) { local = new FreeList; - if (!list.testAndSetRelease(0, local)) { + if (!freeListPtr.testAndSetRelease(0, local)) { delete local; - local = list.loadAcquire(); + local = freeListPtr.loadAcquire(); } } return local; } + +static void qFreeListDeleter() +{ + delete freeListPtr.load(); +} +Q_DESTRUCTOR_FUNCTION(qFreeListDeleter) #endif } |