src/dbus/qdbuspendingcall_p.h
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    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 #ifndef QT_NO_DBUS
    66 #ifndef QT_NO_DBUS
    71 class QDBusConnectionPrivate;
    73 class QDBusConnectionPrivate;
    72 
    74 
    73 class QDBusPendingCallPrivate: public QSharedData
    75 class QDBusPendingCallPrivate: public QSharedData
    74 {
    76 {
    75 public:
    77 public:
    76     QDBusMessage sentMessage;
    78     // {
    77     QDBusMessage replyMessage;
    79     //     set only during construction:
    78 //    QDBusMessage pendingReplyMessage; // used in the local loop
    80     const QDBusMessage sentMessage;
    79     QDBusPendingCallWatcherHelper *watcherHelper;
    81     QDBusConnectionPrivate * const connection;
    80     DBusPendingCall *pending;
       
    81     QDBusConnectionPrivate *connection;
       
    82 
    82 
    83     QString expectedReplySignature;
    83     // for the callback mechanism (see setReplyCallback and QDBusConnectionPrivate::sendWithReplyAsync)
    84     int expectedReplyCount;
       
    85 
       
    86     // for the callback
       
    87     QPointer<QObject> receiver;
    84     QPointer<QObject> receiver;
    88     QList<int> metaTypes;
    85     QList<int> metaTypes;
    89     int methodIdx;
    86     int methodIdx;
    90 
    87 
    91     bool autoDelete;
    88     bool autoDelete;
       
    89     // }
    92 
    90 
    93     QDBusPendingCallPrivate() : watcherHelper(0), pending(0), autoDelete(false)
    91     mutable QMutex mutex;
       
    92     QWaitCondition waitForFinishedCondition;
       
    93 
       
    94     // {
       
    95     //    protected by the mutex above:
       
    96     QDBusPendingCallWatcherHelper *watcherHelper;
       
    97     QDBusMessage replyMessage;
       
    98     DBusPendingCall *pending;
       
    99     volatile bool waitingForFinished;
       
   100 
       
   101     QString expectedReplySignature;
       
   102     int expectedReplyCount;
       
   103     // }
       
   104 
       
   105     QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection)
       
   106         : sentMessage(sent), connection(connection), autoDelete(false), watcherHelper(0), pending(0), waitingForFinished(false)
    94     { }
   107     { }
    95     ~QDBusPendingCallPrivate();
   108     ~QDBusPendingCallPrivate();
    96     bool setReplyCallback(QObject *target, const char *member);
   109     bool setReplyCallback(QObject *target, const char *member);
    97     void waitForFinished();
   110     void waitForFinished();
    98     void setMetaTypes(int count, const int *types);
   111     void setMetaTypes(int count, const int *types);