IPCChannel.h 752 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #pragma once
  2. #include "../Core/Mutex.h"
  3. #include "../Core/Thread.h"
  4. #include "../Core/Object.h"
  5. #include "IPC.h"
  6. #include "IPCMessage.h"
  7. #include "IPCUnix.h"
  8. namespace Atomic
  9. {
  10. class IPCChannel : public Object, public Thread
  11. {
  12. OBJECT(IPCChannel)
  13. public:
  14. IPCChannel(Context* context);
  15. virtual ~IPCChannel();
  16. virtual void ThreadFunction() {}
  17. bool Receive();
  18. void PostMessage(StringHash eventType, VariantMap& eventData);
  19. protected:
  20. // for access from thread
  21. WeakPtr<IPC> ipc_;
  22. // for brokers this is the worker process
  23. // for workers, the broker process
  24. SharedPtr<IPCProcess> otherProcess_;
  25. PipeTransport transport_;
  26. IPCMessageHeader currentHeader_;
  27. VectorBuffer dataBuffer_;
  28. };
  29. }