Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Apr 25, 2024
1 parent 92afad3 commit 44b3d0f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/swoole_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ struct ReactorThread {
MessageBus message_bus;

int init(Server *serv, Reactor *reactor, uint16_t reactor_id);
void shutdown(Reactor *reactor);
};

struct ServerPortGS {
Expand Down Expand Up @@ -1125,6 +1126,7 @@ class Server {
}

void stop_async_worker(Worker *worker);
void stop_master_thread();

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

bool is_running() {
return running;
}

bool is_master() {
return swoole_get_process_type() == SW_PROCESS_MASTER;
}
Expand All @@ -1174,6 +1180,10 @@ class Server {
return is_thread_mode() && swoole_get_thread_type() == Server::THREAD_WORKER;
}

bool is_worker_process() {
return !is_thread_mode() && (is_worker() || is_task_worker());
}

bool is_reactor_thread() {
return swoole_get_thread_type() == Server::THREAD_REACTOR;
}
Expand Down Expand Up @@ -1421,6 +1431,15 @@ class Server {
void worker_signal_init(void);
std::function<void(const WorkerFn &fn)> worker_thread_start;

/**
* [Master]
*/
bool signal_handler_shutdown();
bool signal_handler_child_exit();
bool signal_handler_reload(bool reload_all_workers);
bool signal_handler_read_message();
bool signal_handler_reopen_logger();

static int worker_main_loop(ProcessPool *pool, Worker *worker);
static void worker_signal_handler(int signo);
static void reactor_thread_main_loop(Server *serv, int reactor_id);
Expand Down

0 comments on commit 44b3d0f

Please sign in to comment.