mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 13:41:28 +00:00
goodbye_cruel_world hook for gevent
This commit is contained in:
@@ -49,6 +49,13 @@ PyObject *py_uwsgi_gevent_graceful(PyObject *self, PyObject *args) {
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
void uwsgi_gevent_gbcw() {
|
||||
|
||||
uwsgi_log("...The work of process %d is done. Seeya!\n", getpid());
|
||||
|
||||
py_uwsgi_gevent_graceful(NULL, NULL);
|
||||
}
|
||||
|
||||
struct wsgi_request *uwsgi_gevent_current_wsgi_req(void) {
|
||||
PyObject *current_greenlet = GET_CURRENT_GREENLET;
|
||||
PyObject *py_wsgi_req = PyObject_GetAttrString(current_greenlet, "uwsgi_wsgi_req");
|
||||
@@ -372,6 +379,9 @@ void gevent_loop() {
|
||||
i++;
|
||||
}
|
||||
|
||||
// patch goodbye_cruel_world
|
||||
uwsgi.gbcw_hook = uwsgi_gevent_gbcw;
|
||||
|
||||
// map SIGHUP with gevent.signal
|
||||
PyObject *ge_signal_tuple = PyTuple_New(2);
|
||||
PyTuple_SetItem(ge_signal_tuple, 0, PyInt_FromLong(SIGHUP));
|
||||
|
||||
@@ -720,8 +720,7 @@ void end_me(int signum) {
|
||||
exit(UWSGI_END_CODE);
|
||||
}
|
||||
|
||||
|
||||
void goodbye_cruel_world() {
|
||||
void simple_goodbye_cruel_world() {
|
||||
|
||||
#ifdef UWSGI_THREADING
|
||||
if (uwsgi.threads > 1 && !uwsgi.to_hell) {
|
||||
@@ -734,6 +733,16 @@ void goodbye_cruel_world() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void goodbye_cruel_world() {
|
||||
|
||||
if (!uwsgi.gbcw_hook) {
|
||||
simple_goodbye_cruel_world();
|
||||
}
|
||||
else {
|
||||
uwsgi.gbcw_hook();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UWSGI_SPOOLER
|
||||
static void uwsgi_signal_spoolers(int signum) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user