IPCChannel.h 860 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifdef ATOMIC_PLATFORM_WINDOWS
  9. // Windows defines PostMessage as PostMessgeA/W
  10. #undef PostMessage
  11. #endif
  12. namespace Atomic
  13. {
  14. class IPCChannel : public Object, public Thread
  15. {
  16. OBJECT(IPCChannel)
  17. public:
  18. IPCChannel(Context* context);
  19. virtual ~IPCChannel();
  20. virtual void ThreadFunction() {}
  21. bool Receive();
  22. void PostMessage(StringHash eventType, VariantMap& eventData);
  23. protected:
  24. // for access from thread
  25. WeakPtr<IPC> ipc_;
  26. // for brokers this is the worker process
  27. // for workers, the broker process
  28. SharedPtr<IPCProcess> otherProcess_;
  29. PipeTransport transport_;
  30. IPCMessageHeader currentHeader_;
  31. VectorBuffer dataBuffer_;
  32. };
  33. }