Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed May 9, 2024
1 parent b0cafc8 commit 9d59862
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions include/swoole_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ class ThreadFactory : public BaseFactory {
public:
ThreadFactory(Server *server);
~ThreadFactory();
void spawn_event_worker(int i);
void spawn_task_worker(int i);
void spawn_user_worker(int i);
void spawn_manager_thread(int i);
void spawn_event_worker(WorkerId i);
void spawn_task_worker(WorkerId i);
void spawn_user_worker(WorkerId i);
void spawn_manager_thread(WorkerId i);
void wait();
bool start() override;
bool shutdown() override;
Expand Down
8 changes: 4 additions & 4 deletions src/server/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void ThreadFactory::create_thread(int i, _Callable fn) {
threads_[i] = std::thread(fn);
}

Check warning on line 83 in src/server/thread.cc

View check run for this annotation

Codecov / codecov/patch

src/server/thread.cc#L82-L83

Added lines #L82 - L83 were not covered by tests

void ThreadFactory::spawn_event_worker(int i) {
void ThreadFactory::spawn_event_worker(WorkerId i) {
create_thread(i, [=]() {
swoole_set_process_type(SW_PROCESS_EVENTWORKER);
swoole_set_thread_type(Server::THREAD_WORKER);
Expand All @@ -96,7 +96,7 @@ void ThreadFactory::spawn_event_worker(int i) {
});
}

Check warning on line 97 in src/server/thread.cc

View check run for this annotation

Codecov / codecov/patch

src/server/thread.cc#L85-L97

Added lines #L85 - L97 were not covered by tests

void ThreadFactory::spawn_task_worker(int i) {
void ThreadFactory::spawn_task_worker(WorkerId i) {
create_thread(i, [=]() {
swoole_set_process_type(SW_PROCESS_TASKWORKER);
swoole_set_thread_type(Server::THREAD_WORKER);
Expand All @@ -120,7 +120,7 @@ void ThreadFactory::spawn_task_worker(int i) {
});
}

Check warning on line 121 in src/server/thread.cc

View check run for this annotation

Codecov / codecov/patch

src/server/thread.cc#L118-L121

Added lines #L118 - L121 were not covered by tests

void ThreadFactory::spawn_user_worker(int i) {
void ThreadFactory::spawn_user_worker(WorkerId i) {
create_thread(i, [=]() {
Worker *worker = server_->user_worker_list.at(i - server_->task_worker_num - server_->worker_num);
swoole_set_process_type(SW_PROCESS_USERWORKER);
Expand All @@ -134,7 +134,7 @@ void ThreadFactory::spawn_user_worker(int i) {
});
}

Check warning on line 135 in src/server/thread.cc

View check run for this annotation

Codecov / codecov/patch

src/server/thread.cc#L123-L135

Added lines #L123 - L135 were not covered by tests

void ThreadFactory::spawn_manager_thread(int i) {
void ThreadFactory::spawn_manager_thread(WorkerId i) {
create_thread(i, [=]() {
swoole_set_process_type(SW_PROCESS_MANAGER);
swoole_set_thread_type(Server::THREAD_WORKER);
Expand Down

0 comments on commit 9d59862

Please sign in to comment.