Changeset 805


Ignore:
Timestamp:
Oct 26, 2010, 3:02:14 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

corelib: Fixed a hang when attempting to stop the file watcher thread after reusing it for more than one directory (e.g. like in the standard file dialog).

Location:
trunk/src/corelib/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/corelib/io/qfilesystemwatcher_os2.cpp

    r702 r805  
    9595
    9696QOS2FileSystemWatcherEngine::QOS2FileSystemWatcherEngine()
    97     : notifyPipe(NULLHANDLE), eventSem(NULLHANDLE), finish(false)
     97    : notifyPipe(NULLHANDLE), eventSem(NULLHANDLE), isRunning(false)
    9898{
    9999    ULONG dummy;
     
    163163    }
    164164
    165     start(IdlePriority);
     165    if (!isRunning) {
     166        // (re)start the watcher thread
     167        isRunning = true;
     168        start(IdlePriority);
     169    }
    166170
    167171    return p;
     
    199203    if (watchedPaths.isEmpty()) {
    200204        // stop the thread
    201         finish = true;
     205        isRunning = false;
    202206        DosPostEventSem(eventSem);
    203207        locker.unlock();
     
    221225        qDosNI(arc = DosWaitEventSem(eventSem, SEM_INDEFINITE_WAIT));
    222226        locker.relock();
    223 
    224         if (finish)
     227       
     228        if (!isRunning)
    225229            break;
    226230
     
    312316{
    313317    QMutexLocker locker(&mutex);
    314     if (!finish) {
    315         finish = true;
     318    if (isRunning) {
     319        isRunning = false;
    316320        DosPostEventSem(eventSem);
    317321        locker.unlock();
  • TabularUnified trunk/src/corelib/io/qfilesystemwatcher_os2_p.h

    r659 r805  
    8787    HFILE notifyPipe;
    8888    HEV eventSem;
    89     bool finish;
     89    bool isRunning;
    9090
    9191    enum Type { None = 0, Dir, File };
Note: See TracChangeset for help on using the changeset viewer.