Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Mar 8, 2024
1 parent 7686040 commit 80917e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 3 additions & 10 deletions core/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void *uwsgi_get_loop(char *name) {

void simple_loop() {
uwsgi_loop_cores_run(simple_loop_run);
// Other threads may still run. Make sure they will stop.
uwsgi.workers[uwsgi.mywid].manage_next_request = 0;

if (uwsgi.workers[uwsgi.mywid].shutdown_sockets)
uwsgi_shutdown_all_sockets();
}
Expand All @@ -72,16 +75,6 @@ void uwsgi_loop_cores_run(void *(*func) (void *)) {
}
long y = 0;
func((void *) y);

// main thread waits other threads.
uwsgi.workers[uwsgi.mywid].manage_next_request = 0;

for (i = 1; i < uwsgi.threads; i++) {
int ret = pthread_join(uwsgi.workers[uwsgi.mywid].cores[i].thread_id, NULL);
if (ret) {
uwsgi_log("pthread_join() = %d\n", ret);
}
}
}

void uwsgi_setup_thread_req(long core_id, struct wsgi_request *wsgi_req) {
Expand Down
5 changes: 5 additions & 0 deletions core/uwsgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3718,6 +3718,11 @@ void uwsgi_ignition() {
}
}

// main thread waits other threads.
if (uwsgi.threads > 1) {
wait_for_threads();
}

// end of the process...
end_me(0);
}
Expand Down

0 comments on commit 80917e0

Please sign in to comment.