aboutsummaryrefslogtreecommitdiffstats
path: root/community/php8/atomic-lsapi.patch
blob: 39cf1823f0b397de69a6654f10391b8173e69566 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Patch-Source: https://github.com/php/php-src/pull/7997

diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 2208bbd47b..42dd320356 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);
@@ -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);
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index 42dd320356..0932ebaaa8 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -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();