From 6700e9957ff062af73e14ca63c4dc5c1247ca51b Mon Sep 17 00:00:00 2001 From: MARiA so cute <33935209+NathanFreeman@users.noreply.github.com> Date: Sun, 15 Dec 2024 22:27:40 +0800 Subject: [PATCH] add SW_THREAD_LOCAL (#5619) --- ext-src/swoole_odbc.cc | 2 +- ext-src/swoole_oracle.cc | 2 +- ext-src/swoole_pgsql.cc | 2 +- ext-src/swoole_sqlite.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext-src/swoole_odbc.cc b/ext-src/swoole_odbc.cc index 42a82a69b50..a98701cc702 100644 --- a/ext-src/swoole_odbc.cc +++ b/ext-src/swoole_odbc.cc @@ -24,7 +24,7 @@ #ifdef SW_USE_ODBC -static bool swoole_odbc_blocking = true; +static SW_THREAD_LOCAL bool swoole_odbc_blocking = true; #ifdef SQL_ATTR_CONNECTION_POOLING zend_ulong pdo_odbc_pool_on = SQL_CP_OFF; diff --git a/ext-src/swoole_oracle.cc b/ext-src/swoole_oracle.cc index ace8dc584fb..d62c006050f 100644 --- a/ext-src/swoole_oracle.cc +++ b/ext-src/swoole_oracle.cc @@ -22,7 +22,7 @@ #ifdef SW_USE_ORACLE -static bool swoole_oracle_blocking = true; +static SW_THREAD_LOCAL bool swoole_oracle_blocking = true; void swoole_oracle_set_blocking(bool blocking) { swoole_oracle_blocking = blocking; } diff --git a/ext-src/swoole_pgsql.cc b/ext-src/swoole_pgsql.cc index 86f71b07be9..a984db30dc9 100644 --- a/ext-src/swoole_pgsql.cc +++ b/ext-src/swoole_pgsql.cc @@ -28,7 +28,7 @@ using swoole::Coroutine; using swoole::coroutine::Socket; using swoole::coroutine::translate_events_to_poll; -static bool swoole_pgsql_blocking = true; +static SW_THREAD_LOCAL bool swoole_pgsql_blocking = true; static int swoole_pgsql_socket_poll(PGconn *conn, swEventType event, double timeout = -1) { if (swoole_pgsql_blocking) { diff --git a/ext-src/swoole_sqlite.cc b/ext-src/swoole_sqlite.cc index 9d7822ed7ff..0159ba3383f 100644 --- a/ext-src/swoole_sqlite.cc +++ b/ext-src/swoole_sqlite.cc @@ -23,7 +23,7 @@ #ifdef SW_USE_SQLITE using swoole::Coroutine; -static bool swoole_sqlite_blocking = true; +static SW_THREAD_LOCAL bool swoole_sqlite_blocking = true; void swoole_sqlite_set_blocking(bool blocking) { if (blocking) {