#pragma once #include "../Core/Mutex.h" #include "../Core/Thread.h" #include "../Core/Object.h" #include "IPC.h" #include "IPCMessage.h" #include "IPCUnix.h" #ifdef ATOMIC_PLATFORM_WINDOWS // Windows defines PostMessage as PostMessgeA/W #undef PostMessage #endif namespace Atomic { class IPCChannel : public Object, public Thread { OBJECT(IPCChannel) public: IPCChannel(Context* context, unsigned id); virtual ~IPCChannel(); virtual void ThreadFunction() {} unsigned GetID() { return id_; } bool Receive(); void PostMessage(StringHash eventType, VariantMap& eventData); protected: unsigned id_; // for access from thread WeakPtr ipc_; // for brokers this is the worker process // for workers, the broker process SharedPtr otherProcess_; PipeTransport transport_; IPCMessageHeader currentHeader_; VectorBuffer dataBuffer_; }; }