diff --git a/rtt/base/OperationCallerInterface.cpp b/rtt/base/OperationCallerInterface.cpp index 8094dd5ad..4d689d5d6 100644 --- a/rtt/base/OperationCallerInterface.cpp +++ b/rtt/base/OperationCallerInterface.cpp @@ -31,6 +31,14 @@ bool OperationCallerInterface::setThread(ExecutionThread et, ExecutionEngine* ex return true; } +bool OperationCallerInterface::isSend() +{ + if ( met == ClientThread ) return false; + // OwnThread case: + if ( myengine->getActivity()->thread()->isSelf() ) return false; + return true; // all other OwnThread cases +} + ExecutionEngine* OperationCallerInterface::getMessageProcessor() const { ExecutionEngine* ret = (met == OwnThread ? myengine : GlobalEngine::Instance()); diff --git a/rtt/base/OperationCallerInterface.hpp b/rtt/base/OperationCallerInterface.hpp index 2252fd5db..e3176d878 100644 --- a/rtt/base/OperationCallerInterface.hpp +++ b/rtt/base/OperationCallerInterface.hpp @@ -75,8 +75,10 @@ namespace RTT /** * Helpful function to tell us if this operations is to be sent or not. + * Sending is only required if the operation is OwnThread *and* in a + * different thread than the caller. */ - bool isSend() { return met == OwnThread && myengine != caller; } + bool isSend(); ExecutionEngine* getMessageProcessor() const; diff --git a/rtt/internal/LocalOperationCaller.hpp b/rtt/internal/LocalOperationCaller.hpp index 33bdd6bb0..4f309b5cf 100644 --- a/rtt/internal/LocalOperationCaller.hpp +++ b/rtt/internal/LocalOperationCaller.hpp @@ -285,6 +285,7 @@ namespace RTT if (!this->caller) { log(Error) << "You're using call() an OwnThread operation or collect() on a sent operation without setting a caller in the OperationCaller. This often causes deadlocks." <engine() in a component or GlobalEngine::Instance() in a non-component function. Returning a CollectFailure." <