File: 0001-PHP-8.2-support.patch

package info (click to toggle)
php-excimer 1.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 272 kB
  • sloc: ansic: 1,828; xml: 131; php: 80; makefile: 13; sh: 3
file content (52 lines) | stat: -rw-r--r-- 1,632 bytes parent folder | download
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
From: Tim Starling <tstarling@wikimedia.org>
Date: Wed, 14 Dec 2022 14:28:16 +1100
Subject: PHP 8.2 support

Change-Id: I1abca32237acb70ca20ffa7b4418e2e86b19a02c
---
 excimer_timer.c | 8 +++++++-
 excimer_timer.h | 4 ++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/excimer_timer.c b/excimer_timer.c
index ea82584..4acdc3c 100644
--- a/excimer_timer.c
+++ b/excimer_timer.c
@@ -22,6 +22,12 @@
 #include "php.h"
 #include "excimer_timer.h"
 
+#if PHP_VERSION_ID >= 80200
+#define excimer_timer_atomic_bool_store(dest, value) zend_atomic_bool_store(dest, value)
+#else
+#define excimer_timer_atomic_bool_store(dest, value) *dest = value
+#endif
+
 excimer_timer_globals_t excimer_timer_globals;
 ZEND_TLS excimer_timer_tls_t excimer_timer_tls;
 
@@ -292,7 +298,7 @@ static void excimer_timer_handle(union sigval sv)
 	} else {
 		Z_LVAL_P(zp_event_count) += event_count;
 	}
-	*timer->vm_interrupt_ptr = 1;
+	excimer_timer_atomic_bool_store(timer->vm_interrupt_ptr, 1);
 	/* Release the mutexes */
 	excimer_mutex_unlock(timer->thread_mutex_ptr);
 	excimer_mutex_unlock(&excimer_timer_globals.mutex);
diff --git a/excimer_timer.h b/excimer_timer.h
index 22da41d..ca2ff24 100644
--- a/excimer_timer.h
+++ b/excimer_timer.h
@@ -33,7 +33,11 @@ typedef struct _excimer_timer {
 	int is_running;
 
 	/** &EG(vm_interrupt) in the relevant thread */
+#if PHP_VERSION_ID >= 80200
+	zend_atomic_bool *vm_interrupt_ptr;
+#else
 	zend_bool *vm_interrupt_ptr;
+#endif
 
 	/** A unique ID identifying this object. These IDs are never reused, so that
 	 * the ID can be used to identify events received for deleted objects. The