File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949
5050#if ZTS
5151static atomic_int _thread_count ;
52+ # if PHP_VERSION_ID < 70200
53+ static atomic_bool _ginit_called_once ;
54+ # endif
5255#endif
5356
5457static void _check_enabled (void );
@@ -184,7 +187,12 @@ static PHP_GINIT_FUNCTION(ddappsec)
184187 // We don't really need to call _tshutdown_handler on the main thread,
185188 // though I guess we could do it maybe on MSHUTDOWN or GSHUTDOWN if we
186189 // detected it was running for the main thread globals there.
187- if (!tsrm_is_main_thread ()) {
190+ # if PHP_VERSION_ID >= 70200
191+ bool is_main_thread = tsrm_is_main_thread ();
192+ # else
193+ bool is_main_thread = !atomic_exchange (& _ginit_called_once , true);
194+ # endif
195+ if (!is_main_thread ) {
188196# if defined(__linux__ )
189197 extern void * __dso_handle ;
190198 extern int __cxa_thread_atexit_impl (
@@ -232,6 +240,9 @@ static PHP_GSHUTDOWN_FUNCTION(ddappsec)
232240 dd_log_shutdown ();
233241 zai_config_mshutdown ();
234242 zai_json_shutdown_bindings ();
243+ # if PHP_VERSION_ID < 70200
244+ atomic_store (& _ginit_called_once , false);
245+ # endif
235246 }
236247#else
237248 dd_log_shutdown ();
You can’t perform that action at this time.
0 commit comments