Skip to content

Commit 9d59862

Browse files
committed
optimize code
1 parent b0cafc8 commit 9d59862

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

include/swoole_server.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,10 @@ class ThreadFactory : public BaseFactory {
464464
public:
465465
ThreadFactory(Server *server);
466466
~ThreadFactory();
467-
void spawn_event_worker(int i);
468-
void spawn_task_worker(int i);
469-
void spawn_user_worker(int i);
470-
void spawn_manager_thread(int i);
467+
void spawn_event_worker(WorkerId i);
468+
void spawn_task_worker(WorkerId i);
469+
void spawn_user_worker(WorkerId i);
470+
void spawn_manager_thread(WorkerId i);
471471
void wait();
472472
bool start() override;
473473
bool shutdown() override;

src/server/thread.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void ThreadFactory::create_thread(int i, _Callable fn) {
8282
threads_[i] = std::thread(fn);
8383
}
8484

85-
void ThreadFactory::spawn_event_worker(int i) {
85+
void ThreadFactory::spawn_event_worker(WorkerId i) {
8686
create_thread(i, [=]() {
8787
swoole_set_process_type(SW_PROCESS_EVENTWORKER);
8888
swoole_set_thread_type(Server::THREAD_WORKER);
@@ -96,7 +96,7 @@ void ThreadFactory::spawn_event_worker(int i) {
9696
});
9797
}
9898

99-
void ThreadFactory::spawn_task_worker(int i) {
99+
void ThreadFactory::spawn_task_worker(WorkerId i) {
100100
create_thread(i, [=]() {
101101
swoole_set_process_type(SW_PROCESS_TASKWORKER);
102102
swoole_set_thread_type(Server::THREAD_WORKER);
@@ -120,7 +120,7 @@ void ThreadFactory::spawn_task_worker(int i) {
120120
});
121121
}
122122

123-
void ThreadFactory::spawn_user_worker(int i) {
123+
void ThreadFactory::spawn_user_worker(WorkerId i) {
124124
create_thread(i, [=]() {
125125
Worker *worker = server_->user_worker_list.at(i - server_->task_worker_num - server_->worker_num);
126126
swoole_set_process_type(SW_PROCESS_USERWORKER);
@@ -134,7 +134,7 @@ void ThreadFactory::spawn_user_worker(int i) {
134134
});
135135
}
136136

137-
void ThreadFactory::spawn_manager_thread(int i) {
137+
void ThreadFactory::spawn_manager_thread(WorkerId i) {
138138
create_thread(i, [=]() {
139139
swoole_set_process_type(SW_PROCESS_MANAGER);
140140
swoole_set_thread_type(Server::THREAD_WORKER);

0 commit comments

Comments
 (0)