src/dbus/qdbuspendingcall_p.h
changeset 29 b72c6db6890b
parent 18 2f34d5167611
child 30 5dc02b23752f
equal deleted inserted replaced
25:e24348a560a6 29:b72c6db6890b
    55 #define QDBUSPENDINGCALL_P_H
    55 #define QDBUSPENDINGCALL_P_H
    56 
    56 
    57 #include <qshareddata.h>
    57 #include <qshareddata.h>
    58 #include <qpointer.h>
    58 #include <qpointer.h>
    59 #include <qlist.h>
    59 #include <qlist.h>
       
    60 #include <qmutex.h>
       
    61 #include <qwaitcondition.h>
    60 
    62 
    61 #include "qdbusmessage.h"
    63 #include "qdbusmessage.h"
    62 #include "qdbus_symbols_p.h"
    64 #include "qdbus_symbols_p.h"
    63 
    65 
    64 QT_BEGIN_NAMESPACE
    66 QT_BEGIN_NAMESPACE
    69 class QDBusConnectionPrivate;
    71 class QDBusConnectionPrivate;
    70 
    72 
    71 class QDBusPendingCallPrivate: public QSharedData
    73 class QDBusPendingCallPrivate: public QSharedData
    72 {
    74 {
    73 public:
    75 public:
    74     QDBusMessage sentMessage;
    76     // {
    75     QDBusMessage replyMessage;
    77     //     set only during construction:
    76 //    QDBusMessage pendingReplyMessage; // used in the local loop
    78     const QDBusMessage sentMessage;
    77     QDBusPendingCallWatcherHelper *watcherHelper;
    79     QDBusConnectionPrivate * const connection;
    78     DBusPendingCall *pending;
       
    79     QDBusConnectionPrivate *connection;
       
    80 
    80 
    81     QString expectedReplySignature;
    81     // for the callback mechanism (see setReplyCallback and QDBusConnectionPrivate::sendWithReplyAsync)
    82     int expectedReplyCount;
       
    83 
       
    84     // for the callback
       
    85     QPointer<QObject> receiver;
    82     QPointer<QObject> receiver;
    86     QList<int> metaTypes;
    83     QList<int> metaTypes;
    87     int methodIdx;
    84     int methodIdx;
    88 
    85 
    89     bool autoDelete;
    86     bool autoDelete;
       
    87     // }
    90 
    88 
    91     QDBusPendingCallPrivate() : watcherHelper(0), pending(0), autoDelete(false)
    89     mutable QMutex mutex;
       
    90     QWaitCondition waitForFinishedCondition;
       
    91 
       
    92     // {
       
    93     //    protected by the mutex above:
       
    94     QDBusPendingCallWatcherHelper *watcherHelper;
       
    95     QDBusMessage replyMessage;
       
    96     DBusPendingCall *pending;
       
    97     volatile bool waitingForFinished;
       
    98 
       
    99     QString expectedReplySignature;
       
   100     int expectedReplyCount;
       
   101     // }
       
   102 
       
   103     QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection)
       
   104         : sentMessage(sent), connection(connection), autoDelete(false), watcherHelper(0), pending(0), waitingForFinished(false)
    92     { }
   105     { }
    93     ~QDBusPendingCallPrivate();
   106     ~QDBusPendingCallPrivate();
    94     bool setReplyCallback(QObject *target, const char *member);
   107     bool setReplyCallback(QObject *target, const char *member);
    95     void waitForFinished();
   108     void waitForFinished();
    96     void setMetaTypes(int count, const int *types);
   109     void setMetaTypes(int count, const int *types);