Skip to content

Commit

Permalink
Fix multi-threaded exit
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Jul 28, 2024
1 parent a28ef0b commit 6bf95fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All changes to the Agoo gem are documented here. Releases follow semantic versioning.

## [2.15.12] - 2024-07-28

### Fixed

- When multiple threads are specified and the main thread exits worker
threads not exit as well.

## [2.15.11] - 2024-06-04

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion example/multi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def call(req)
end

# To run this example type the following then go to a browser and enter a URL of localhost:6464/hello.
# ruby hello.rb
# ruby multi.rb
6 changes: 6 additions & 0 deletions ext/agoo/rserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ wrap_process_loop(void *ptr) {
return Qnil;
}

static void on_exit(VALUE x) {
agoo_server.active = false;
}

/* Document-method: start
*
* call-seq: start()
Expand Down Expand Up @@ -908,6 +912,8 @@ rserver_start(VALUE self) {
dsleep(0.05);
}
}
rb_set_end_proc(on_exit, Qnil);

return Qnil;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/agoo/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module Agoo
# Agoo version.
VERSION = '2.15.11'
VERSION = '2.15.12'
end

0 comments on commit 6bf95fd

Please sign in to comment.