diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-29 09:07:43 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-09-02 12:41:07 +0000 |
commit | 7c0884f2a2b02ed91ee49f79ef2fff27c2567c39 (patch) | |
tree | 64661ff40d4e36b6320c1bd2ff5d15d56a446875 /src/corelib/thread/qthread_win.cpp | |
parent | 30756f4626972d90e1b6e24f495260c1268c9181 (diff) |
Windows code: Fix clang-tidy warnings about else after jumps
Replace by switch() where appropriate, remove else and unindent code
or simplify the return value.
Change-Id: Ie988b9068a9579ae5a899b3765e43aad480b564e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qthread_win.cpp')
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 5714f5236c..caf51722cd 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -260,31 +260,27 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID) } const int handleIndex = offset + ret - WAIT_OBJECT_0; - if (handleIndex == 0){ - // New handle to watch was added. + if (handleIndex == 0) // New handle to watch was added. continue; - } else { -// printf("(qt) - qt_adopted_thread_watcher_function... called\n"); - const int qthreadIndex = handleIndex - 1; + const int qthreadIndex = handleIndex - 1; - qt_adopted_thread_watcher_mutex.lock(); - QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex)); - qt_adopted_thread_watcher_mutex.unlock(); - if (data->isAdopted) { - QThread *thread = data->thread; - Q_ASSERT(thread); - QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread)); - Q_UNUSED(thread_p) - Q_ASSERT(!thread_p->finished); - thread_p->finish(thread); - } - data->deref(); - - QMutexLocker lock(&qt_adopted_thread_watcher_mutex); - CloseHandle(qt_adopted_thread_handles.at(handleIndex)); - qt_adopted_thread_handles.remove(handleIndex); - qt_adopted_qthreads.remove(qthreadIndex); + qt_adopted_thread_watcher_mutex.lock(); + QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex)); + qt_adopted_thread_watcher_mutex.unlock(); + if (data->isAdopted) { + QThread *thread = data->thread; + Q_ASSERT(thread); + auto thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread)); + Q_UNUSED(thread_p) + Q_ASSERT(!thread_p->finished); + QThreadPrivate::finish(thread); } + data->deref(); + + QMutexLocker lock(&qt_adopted_thread_watcher_mutex); + CloseHandle(qt_adopted_thread_handles.at(handleIndex)); + qt_adopted_thread_handles.remove(handleIndex); + qt_adopted_qthreads.remove(qthreadIndex); } QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index)); |