From d14174f7013a94f232ca3f5b6598d5a7a8f2e362 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Tue, 25 Jan 2022 09:10:04 +0200 Subject: [PATCH] Use __atomic_test_and_set() instead of __sync_test_and_set() for lsapi Related to #7914 --- sapi/litespeed/lsapilib.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index 2208bbd47b23b..0932ebaaa81c5 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/lsapilib.c @@ -443,7 +443,7 @@ static void lsapi_close_connection(LSAPI_Request *pReq) if (s_busy_workers) __sync_fetch_and_sub(s_busy_workers, 1); if (s_worker_status) - __sync_lock_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE); + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE); } @@ -1587,7 +1587,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq ) else { if (s_worker_status) - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_CONNECTED); if (s_busy_workers) __sync_fetch_and_add(s_busy_workers, 1); @@ -3315,7 +3315,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer, if (pthread_atfork_func) (*pthread_atfork_func)(NULL, NULL, set_skip_write); - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_CONNECTED); if (s_busy_workers) __sync_add_and_fetch(s_busy_workers, 1); @@ -3390,7 +3390,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq) { int max_children = g_prefork_server->m_iMaxChildren; s_pid = getpid(); - __sync_lock_test_and_set(&pReq->child_status->m_pid, s_pid); + __atomic_test_and_set(&pReq->child_status->m_pid, s_pid); s_worker_status = pReq->child_status; setsid(); @@ -3402,7 +3402,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq) if (pthread_atfork_func) (*pthread_atfork_func)(NULL, NULL, set_skip_write); - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_CONNECTED); if (s_busy_workers) __sync_add_and_fetch(s_busy_workers, 1); @@ -3651,7 +3651,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) if (fd == pReq->m_fdListen) { if (s_worker_status) - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_ACCEPTING); if (s_accepting_workers) __sync_fetch_and_add(s_accepting_workers, 1); @@ -3662,7 +3662,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) if (s_accepting_workers) __sync_fetch_and_sub(s_accepting_workers, 1); if (s_worker_status) - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE); } @@ -3711,7 +3711,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq ) if ( pReq->m_fd != -1 ) { if (s_worker_status) - __sync_lock_test_and_set(&s_worker_status->m_state, + __atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_CONNECTED); if (s_busy_workers) __sync_fetch_and_add(s_busy_workers, 1);