Changeset 947 for trunk/src


Ignore:
Timestamp:
Aug 8, 2011, 9:35:15 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Added debugging to QFilleSystemWatcher impl.

File:
1 edited

Legend:

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

    r946 r947  
    4242****************************************************************************/
    4343
     44//#define QFILESYSTEMWATCHER_DEBUG
     45
    4446#include "qfilesystemwatcher.h"
    4547#include "qfilesystemwatcher_os2_p.h"
     
    5153
    5254#include "qdebug.h"
     55#ifdef QFILESYSTEMWATCHER_DEBUG
     56#define DEBUG(a) qDebug a
     57#else
     58#define DEBUG(a) do {} while(0)
     59#endif
    5360
    5461// OS/2 has the Dos*ChangeNotify API for file system change notifications but
     
    212219        arc = DosQueryPathInfo(QFile::encodeName(path), FIL_STANDARD,
    213220                               &newInfo, sizeof(newInfo));
     221        DEBUG(() << "POLLER ADD" << path << arc);
    214222        if (arc == NO_ERROR)
    215223            watchedPaths.insert(path, newInfo);
     
    228236
    229237    foreach (const QString &path, paths) {
     238        DEBUG(() << "POLLER REMOVE" << path);
    230239        watchedPaths.remove(path);
    231240    }
     
    255264
    256265        locker.relock();
     266
     267        //DEBUG(() << "*** POLLER" << watchedPaths.size() << "items");
    257268
    258269        for (PathMap::iterator it = watchedPaths.begin();
     
    273284                newInfo.attrFile != info.attrFile) {
    274285                // there was a change, memorize it and update the info
     286                DEBUG(() << "POLLER CHANGE!" << path);
    275287                changedPaths << path;
    276288                info = newInfo;
     
    285297void QOS2FileSysPollerThread::stop(QMutexLocker &locker)
    286298{
    287     Q_ASSERT(locker.locked());
    288 
    289299    if (isRunning()) {
    290300        finish = true;
     
    393403    QMutexLocker locker(&mutex);
    394404
     405    DEBUG(() << "WATCHER ADD" << paths);
     406
    395407    QStringList p = paths, pollerPaths;
    396408    QMutableListIterator<QString> it(p);
     
    459471    QMutexLocker locker(&mutex);
    460472
     473    DEBUG(() << "WATCHER REMOVE" << paths);
     474
    461475    QStringList p = paths, pollerPaths;
    462476    QMutableListIterator<QString> it(p);
     
    504518    QMutexLocker locker(&mutex);
    505519
     520    DEBUG(() << "WATCHER REMOVE" << engine);
     521
    506522    QStringList pollerPaths;
    507523    foreach (const QString &normalPath, instance->watchedPaths.keys()) {
     
    542558            foreach(const PathInfo &pi, variants) {
    543559                foreach(QOS2FileSystemWatcherEngine *e, pi.engines) {
    544                     if (pi.type == File)
     560                    if (pi.type == File) {
     561                        DEBUG(() << "WATCHER EMIT FILE"  << pi.path);
    545562                        e->doFileChanged(pi.path, false);
    546                     else
     563                    } else {
     564                        DEBUG(() << "WATCHER EMIT DIR" << pi.path);
    547565                        e->doDirectoryChanged(pi.path, false);
     566                    }
    548567                }
    549568            }
     
    599618                QString normalPath = QString::fromLocal8Bit(info->szName).toUpper();
    600619
     620                //DEBUG(() << "WATCHER NOTIFY" << (int) info->bAction << normalPath);
     621
    601622                switch (info->bAction) {
    602623                case RCNF_FILE_DELETED:
     
    622643                            if (type == pi.type) {
    623644                                foreach(QOS2FileSystemWatcherEngine *e, pi.engines) {
    624                                     if (type == File)
     645                                    if (type == File) {
     646                                        DEBUG(() << "WATCHER EMIT FILE"
     647                                                 << (int) info->bAction << pi.path
     648                                                 << deleted);
    625649                                        e->doFileChanged(pi.path, deleted);
    626                                     else
     650                                    } else {
     651                                        DEBUG(() << "WATCHER EMIT DIR"
     652                                                << (int) info->bAction << pi.path
     653                                                << deleted);
    627654                                        e->doDirectoryChanged(pi.path, deleted);
     655                                    }
    628656                                }
    629657                            }
     
    639667                    if (watchedPaths.contains(normalPath)) {
    640668                        foreach(const PathInfo &pi, watchedPaths[normalPath]) {
    641                             if (pi.type == Dir)
    642                                 foreach(QOS2FileSystemWatcherEngine *e, pi.engines)
     669                            if (pi.type == Dir) {
     670                                foreach(QOS2FileSystemWatcherEngine *e, pi.engines) {
     671                                    DEBUG(() << "WATCHER EMIT DIR"
     672                                             << (int) info->bAction << pi.path);
    643673                                    e->doDirectoryChanged(pi.path, false);
     674                                }
     675                            }
    644676                        }
    645677                    }
     
    661693void QOS2FileSysWatcherThread::stop(QMutexLocker &locker)
    662694{
    663     Q_ASSERT(locker.locked());
    664 
    665695    if (isRunning()) {
    666696        // stop the thread
Note: See TracChangeset for help on using the changeset viewer.