Skip to content

Commit e57d056

Browse files
authored
Use __atomic_test_and_set() instead of __sync_test_and_set() for lsapi (#7997)
Related to GH-7914
1 parent dbf211d commit e57d056

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sapi/litespeed/lsapilib.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static void lsapi_close_connection(LSAPI_Request *pReq)
444444
if (s_busy_workers)
445445
__sync_fetch_and_sub(s_busy_workers, 1);
446446
if (s_worker_status)
447-
__sync_lock_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE);
447+
__atomic_test_and_set(&s_worker_status->m_state, LSAPI_STATE_IDLE);
448448
}
449449

450450

@@ -1588,7 +1588,7 @@ int LSAPI_Accept_r( LSAPI_Request * pReq )
15881588
else
15891589
{
15901590
if (s_worker_status)
1591-
__sync_lock_test_and_set(&s_worker_status->m_state,
1591+
__atomic_test_and_set(&s_worker_status->m_state,
15921592
LSAPI_STATE_CONNECTED);
15931593
if (s_busy_workers)
15941594
__sync_fetch_and_add(s_busy_workers, 1);
@@ -3316,7 +3316,7 @@ static int lsapi_prefork_server_accept( lsapi_prefork_server * pServer,
33163316
if (pthread_atfork_func)
33173317
(*pthread_atfork_func)(NULL, NULL, set_skip_write);
33183318

3319-
__sync_lock_test_and_set(&s_worker_status->m_state,
3319+
__atomic_test_and_set(&s_worker_status->m_state,
33203320
LSAPI_STATE_CONNECTED);
33213321
if (s_busy_workers)
33223322
__sync_add_and_fetch(s_busy_workers, 1);
@@ -3391,7 +3391,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq)
33913391
{
33923392
int max_children = g_prefork_server->m_iMaxChildren;
33933393
s_pid = getpid();
3394-
__sync_lock_test_and_set(&pReq->child_status->m_pid, s_pid);
3394+
__atomic_test_and_set(&pReq->child_status->m_pid, s_pid);
33953395
s_worker_status = pReq->child_status;
33963396

33973397
setsid();
@@ -3403,7 +3403,7 @@ int LSAPI_Postfork_Child(LSAPI_Request * pReq)
34033403
if (pthread_atfork_func)
34043404
(*pthread_atfork_func)(NULL, NULL, set_skip_write);
34053405

3406-
__sync_lock_test_and_set(&s_worker_status->m_state,
3406+
__atomic_test_and_set(&s_worker_status->m_state,
34073407
LSAPI_STATE_CONNECTED);
34083408
if (s_busy_workers)
34093409
__sync_add_and_fetch(s_busy_workers, 1);
@@ -3652,7 +3652,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
36523652
if (fd == pReq->m_fdListen)
36533653
{
36543654
if (s_worker_status)
3655-
__sync_lock_test_and_set(&s_worker_status->m_state,
3655+
__atomic_test_and_set(&s_worker_status->m_state,
36563656
LSAPI_STATE_ACCEPTING);
36573657
if (s_accepting_workers)
36583658
__sync_fetch_and_add(s_accepting_workers, 1);
@@ -3663,7 +3663,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
36633663
if (s_accepting_workers)
36643664
__sync_fetch_and_sub(s_accepting_workers, 1);
36653665
if (s_worker_status)
3666-
__sync_lock_test_and_set(&s_worker_status->m_state,
3666+
__atomic_test_and_set(&s_worker_status->m_state,
36673667
LSAPI_STATE_IDLE);
36683668
}
36693669

@@ -3712,7 +3712,7 @@ int LSAPI_Prefork_Accept_r( LSAPI_Request * pReq )
37123712
if ( pReq->m_fd != -1 )
37133713
{
37143714
if (s_worker_status)
3715-
__sync_lock_test_and_set(&s_worker_status->m_state,
3715+
__atomic_test_and_set(&s_worker_status->m_state,
37163716
LSAPI_STATE_CONNECTED);
37173717
if (s_busy_workers)
37183718
__sync_fetch_and_add(s_busy_workers, 1);

0 commit comments

Comments
 (0)