Skip to content

Commit 44b3d0f

Browse files
committed
Refactor
1 parent 92afad3 commit 44b3d0f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

include/swoole_server.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ struct ReactorThread {
159159
MessageBus message_bus;
160160

161161
int init(Server *serv, Reactor *reactor, uint16_t reactor_id);
162+
void shutdown(Reactor *reactor);
162163
};
163164

164165
struct ServerPortGS {
@@ -1125,6 +1126,7 @@ class Server {
11251126
}
11261127

11271128
void stop_async_worker(Worker *worker);
1129+
void stop_master_thread();
11281130

11291131
Pipe *get_pipe_object(int pipe_fd) {
11301132
return (Pipe *) connection_list[pipe_fd].object;
@@ -1150,6 +1152,10 @@ class Server {
11501152
return factory != nullptr;
11511153
}
11521154

1155+
bool is_running() {
1156+
return running;
1157+
}
1158+
11531159
bool is_master() {
11541160
return swoole_get_process_type() == SW_PROCESS_MASTER;
11551161
}
@@ -1174,6 +1180,10 @@ class Server {
11741180
return is_thread_mode() && swoole_get_thread_type() == Server::THREAD_WORKER;
11751181
}
11761182

1183+
bool is_worker_process() {
1184+
return !is_thread_mode() && (is_worker() || is_task_worker());
1185+
}
1186+
11771187
bool is_reactor_thread() {
11781188
return swoole_get_thread_type() == Server::THREAD_REACTOR;
11791189
}
@@ -1421,6 +1431,15 @@ class Server {
14211431
void worker_signal_init(void);
14221432
std::function<void(const WorkerFn &fn)> worker_thread_start;
14231433

1434+
/**
1435+
* [Master]
1436+
*/
1437+
bool signal_handler_shutdown();
1438+
bool signal_handler_child_exit();
1439+
bool signal_handler_reload(bool reload_all_workers);
1440+
bool signal_handler_read_message();
1441+
bool signal_handler_reopen_logger();
1442+
14241443
static int worker_main_loop(ProcessPool *pool, Worker *worker);
14251444
static void worker_signal_handler(int signo);
14261445
static void reactor_thread_main_loop(Server *serv, int reactor_id);

0 commit comments

Comments
 (0)