IPCWorker.cpp 602 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "../IO/Log.h"
  2. #include "IPCWorker.h"
  3. #include "IPCMessage.h"
  4. #include "IPCUnix.h"
  5. namespace Atomic
  6. {
  7. IPCWorker::IPCWorker(int fd, Context* context) : IPCChannel(context),
  8. fd_(fd)
  9. {
  10. if (!transport_.OpenClient(fd_))
  11. {
  12. LOGERRORF("Unable to open IPC transport fd = %i", fd_);
  13. shouldRun_ = false;
  14. return;
  15. }
  16. LOGERRORF("Opened IPC transport fd = %i", fd_);
  17. }
  18. IPCWorker::~IPCWorker()
  19. {
  20. }
  21. void IPCWorker::ThreadFunction()
  22. {
  23. while(shouldRun_)
  24. {
  25. if (!Receive())
  26. {
  27. Stop();
  28. break;
  29. }
  30. }
  31. }
  32. }