28 #include <condition_variable>
33 #include <Ice/ObjectAdapter.h>
34 #include <IceUtil/UUID.h>
36 #include <ArmarXCore/interface/core/util/distributed/RemoteHandle/RemoteHandleControlBlock.h>
38 #include "../../../services/tasks/PeriodicTask.h"
39 #include "../../../ArmarXManager.h"
44 class RemoteHandleControlBlock;
69 std::mutex stateMutex;
72 std::set<RemoteHandleControlBlockPtr> rhs;
73 std::chrono::milliseconds deletionDelay;
103 virtual public RemoteHandleControlBlockInterface
106 using clock = std::chrono::steady_clock;
107 inline static int64_t
now();
127 template<
class Deleter>
159 forcedDeletion =
true;
169 inline void cleanup();
175 std::function<void(
void)> deleter;
176 Ice::ObjectPrx managedObjectProxy;
180 RemoteHandleControlBlockInterfacePrx selfProxy;
182 mutable std::atomic<uint64_t> useCount {0};
183 mutable std::mutex mtx;
184 mutable clock::time_point lastTimeUseCountReachedZero;
185 mutable std::atomic_bool forcedDeletion {
false};
202 return managedObjectProxy;
205 void RemoteHandleControlBlock::cleanup()
211 objectAdapter->remove(selfProxy->ice_getIdentity());
214 template<
class Deleter>
218 auto clientSideRemoteHandleControlBlock = block->getClientSideRemoteHandleControlBlock();
219 manager->getSharedRemoteHandleState()->add(block);
220 return {block, clientSideRemoteHandleControlBlock};