Skip to content

Use __atomic_test_and_set() instead of __sync_test_and_set() for lsapi #7997

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

Merged
merged 1 commit into from
Nov 18, 2022
Merged
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
16 changes: 8 additions & 8 deletions sapi/litespeed/lsapilib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand Down