25 #include <dcop_deadlock_test.h>
29 #include <sys/types.h>
33 MyDCOPObject::MyDCOPObject(
const TQCString &name,
const TQCString &remoteName)
36 connect(&m_timer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(slotTimeout()));
39 bool MyDCOPObject::process(
const TQCString &fun,
const TQByteArray &data,
40 TQCString& replyType, TQByteArray &replyData)
42 if (fun ==
"function(TQCString)") {
43 TQDataStream args( data, IO_ReadOnly );
48 tqWarning(
"%s: function('%s') %d:%06d",
name(), m_remoteName.data(), tv.tv_sec % 100, tv.tv_usec);
50 replyType =
"TQString";
51 TQDataStream reply( replyData, IO_WriteOnly );
52 reply << TQString(
"Hey");
53 m_timer.start(1000,
true);
59 void MyDCOPObject::slotTimeout()
63 tqWarning(
"%s: slotTimeout() %d:%06d",
name(), tv.tv_sec % 100, tv.tv_usec);
65 m_timer.start(1000,
true);
69 tqWarning(
"%s: Got result '%s' %d:%06d",
name(), result.latin1(), tv.tv_sec % 100, tv.tv_usec);
72 int main(
int argc,
char **argv)
77 tqWarning(
"%d:I am '%s'", getpid(), app.dcopClient()->appId().data());
79 if (myName ==
"testdcop")
81 system(
"./dcop_deadlock_test testdcop&");
89 MyDCOPObject myObject(app.dcopClient()->appId(), remoteApp);
91 if (!remoteApp.isEmpty())
92 myObject.slotTimeout();
96 #include "dcop_deadlock_test.moc"
TQCString registerAs(const TQCString &appId, bool addPID=true)
Registers at the DCOP server.
Provides an interface for receiving DCOP messages.
virtual bool process(const TQCString &fun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData)
Dispatches a message.
A DCOPRef(erence) encapsulates a remote DCOP object as a triple <app,obj,type> where type is optional...
DCOPReply call(const TQCString &fun)
Calls the function fun on the object referenced by this reference.
bool get(T &t, const char *tname)
Retrieves the value from the type T.
static DCOPClient * dcopClient()
TQString name(StdAccel id)