Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0]Fix bug #5080 #5081

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ext-src/swoole_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ static PHP_METHOD(swoole_process, signal) {
if (zcallback == nullptr) {
fci_cache = signal_fci_caches[signo];
if (fci_cache) {
#ifdef SW_USE_THREAD_CONTEXT
swoole_event_defer([signo](void *) { swoole_signal_set(signo, nullptr); }, nullptr);
#else
swoole_signal_set(signo, nullptr);
#endif
signal_fci_caches[signo] = nullptr;
swoole_event_defer(sw_zend_fci_cache_free, fci_cache);
SwooleTG.signal_listener_num--;
Expand Down Expand Up @@ -486,7 +490,11 @@ static PHP_METHOD(swoole_process, signal) {
SwooleTG.signal_listener_num++;
}
signal_fci_caches[signo] = fci_cache;
#ifdef SW_USE_THREAD_CONTEXT
swoole_event_defer([signo, handler](void *) { swoole_signal_set(signo, handler); }, nullptr);
#else
swoole_signal_set(signo, handler);
#endif
RETURN_TRUE;
}

Expand All @@ -506,7 +514,11 @@ static PHP_METHOD(swoole_process, signal) {
}
signal_fci_caches[signo] = fci_cache;

#ifdef SW_USE_THREAD_CONTEXT
swoole_event_defer([signo, handler](void *) { swoole_signal_set(signo, handler); }, nullptr);
#else
swoole_signal_set(signo, handler);
#endif

RETURN_TRUE;
}
Expand Down
4 changes: 4 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2415,5 +2415,9 @@
<configureoption default="no" name="enable-swoole-curl" prompt="enable curl support?"/>
<configureoption default="no" name="enable-cares" prompt="enable cares support?"/>
<configureoption default="yes" name="enable-brotli" prompt="enable brotli support?"/>
<configureoption default="no" name="enable-swoole-pgsql" prompt="enable PostgreSQL database support?"/>
<configureoption default="no" name="with-swoole-odbc" prompt="enable ODBC database support?"/>
<configureoption default="no" name="with-swoole-oracle" prompt="enable Oracle database support?"/>
<configureoption default="no" name="enable-swoole-sqlite" prompt="enable Sqlite database support?"/>
</extsrcrelease>
</package>
2 changes: 2 additions & 0 deletions src/coroutine/thread_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "swoole_api.h"
#include "swoole_async.h"
#include "swoole_signal.h"
#include "swoole_coroutine_context.h"

#ifdef SW_USE_THREAD_CONTEXT
Expand Down Expand Up @@ -88,6 +89,7 @@ bool Context::swap_out() {
}

void Context::context_func(void *arg) {
swoole_signal_block_all();
Context *_this = (Context *) arg;
SwooleTG.reactor = g_reactor;
SwooleTG.timer = g_timer;
Expand Down
Loading