Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/thread/qthread_win.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5555#include <private/qeventdispatcher_win_p.h>
    5656
    57 #include <windows.h>
     57#include <windows.h>
    5858
    5959
     
    113113            // avoid recursion.
    114114            TlsSetValue(qt_current_thread_data_tls_index, threadData);
    115             threadData->thread = new QAdoptedThread(threadData);
     115            QT_TRY {
     116                threadData->thread = new QAdoptedThread(threadData);
     117            } QT_CATCH(...) {
     118                TlsSetValue(qt_current_thread_data_tls_index, 0);
     119                threadData->deref();
     120                threadData = 0;
     121                QT_RETHROW;
     122            }
    116123            threadData->deref();
    117124        }
     
    164171    if (qt_adopted_thread_watcher_handle == 0) {
    165172        if (qt_adopted_thread_wakeup == 0) {
    166             qt_adopted_thread_wakeup = QT_WA_INLINE(CreateEventW(0, false, false, 0),
    167                                                     CreateEventA(0, false, false, 0));
     173            qt_adopted_thread_wakeup = CreateEvent(0, false, false, 0);
    168174            qt_adopted_thread_handles.prepend(qt_adopted_thread_wakeup);
    169175        }
     
    293299    data->quitNow = false;
    294300    // ### TODO: allow the user to create a custom event dispatcher
    295     if (QCoreApplication::instance())
    296         createEventDispatcher(data);
     301    createEventDispatcher(data);
    297302
    298303#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)
     
    366371{
    367372#ifndef Q_OS_WINCE
    368     if (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
    369         SwitchToThread();
    370     else
     373   
     374#else
     375   
    371376#endif
    372         ::Sleep(0);
    373377}
    374378
     
    421425    }
    422426
    423     // Since Win 9x will have problems if the priority is idle or time critical
    424     // we have to use the closest one instead
    425427    int prio;
    426428    d->priority = priority;
    427429    switch (d->priority) {
    428430    case IdlePriority:
    429         if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
    430             prio = THREAD_PRIORITY_LOWEST;
    431         } else {
    432             prio = THREAD_PRIORITY_IDLE;
    433         }
     431        prio = THREAD_PRIORITY_IDLE;
    434432        break;
    435433
     
    455453
    456454    case TimeCriticalPriority:
    457         if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
    458             prio = THREAD_PRIORITY_HIGHEST;
    459         } else {
    460             prio = THREAD_PRIORITY_TIME_CRITICAL;
    461         }
     455        prio = THREAD_PRIORITY_TIME_CRITICAL;
    462456        break;
    463457
     
    565559    // copied from start() with a few modifications:
    566560
    567     // Since Win 9x will have problems if the priority is idle or time critical
    568     // we have to use the closest one instead
    569561    int prio;
    570562    d->priority = priority;
    571563    switch (d->priority) {
    572564    case IdlePriority:
    573         if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
    574             prio = THREAD_PRIORITY_LOWEST;
    575         } else {
    576             prio = THREAD_PRIORITY_IDLE;
    577         }
     565        prio = THREAD_PRIORITY_IDLE;
    578566        break;
    579567
     
    599587
    600588    case TimeCriticalPriority:
    601         if (QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
    602             prio = THREAD_PRIORITY_HIGHEST;
    603         } else {
    604             prio = THREAD_PRIORITY_TIME_CRITICAL;
    605         }
     589        prio = THREAD_PRIORITY_TIME_CRITICAL;
    606590        break;
    607591
Note: See TracChangeset for help on using the changeset viewer.