Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
controller_manager.h
Go to the documentation of this file.
1 // Copyright 2016 Google Inc.
16 
17 #ifndef PAGESPEED_CONTROLLER_MANAGER_H_
18 #define PAGESPEED_CONTROLLER_MANAGER_H_
19 
20 #include <memory>
21 
28 
29 namespace net_instaweb {
30 
47  public:
51  static void ForkControllerProcess(
52  std::unique_ptr<ControllerProcess>&& process,
53  SystemRewriteDriverFactory* factory, ThreadSystem* thread_system,
54  MessageHandler* handler);
55 
58  static void DetachFromControllerProcess();
59 
60  private:
62  static void Daemonize(MessageHandler* handler);
63 
65  static int RunController(int controller_read_fd, ControllerProcess* process,
66  ThreadSystem* thread_system,
67  MessageHandler* handler);
68 
69  class ProcessDeathWatcherThread : public ThreadSystem::Thread {
70  public:
73  ProcessDeathWatcherThread(ThreadSystem* thread_system,
74  int parent_read_fd,
75  ControllerProcess* process,
76  MessageHandler* handler);
77 
78  ~ProcessDeathWatcherThread();
79 
80  void Run() override;
81 
84  void Stop();
85 
86  bool parent_death_detected() const { return parent_death_detected_; }
87 
88  private:
89  MessageHandler* handler_;
90  const int parent_read_fd_;
91  int stop_read_fd_;
92  int stop_write_fd_;
93  ControllerProcess* process_;
94  bool parent_death_detected_;
95 
96 
97  };
98 
99  static int controller_write_fd_;
100 
101 
102 };
103 
104 }
105 
106 #endif
static void DetachFromControllerProcess()
A server context with features specific to a psol port on a unix system.
Definition: system_rewrite_driver_factory.h:57
Definition: controller_manager.h:46
static void ForkControllerProcess(std::unique_ptr< ControllerProcess > &&process, SystemRewriteDriverFactory *factory, ThreadSystem *thread_system, MessageHandler *handler)
Definition: controller_process.h:39
Definition: thread_system.h:40
Definition: message_handler.h:39
Base class for client thread code.
Definition: thread.h:34