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
use ;
/// RAII guard for PHP ZTS thread-local state.
///
/// Initializes PHP thread-local storage on creation and cleans it up on drop.
/// Must be created on a dedicated OS thread after the main SAPI has been
/// started with `sapi_startup()` + `php_module_startup()`.
///
/// # Safety
///
/// The guard must not outlive the SAPI module. Drop all guards before calling
/// `php_module_shutdown()`.
///
/// # Examples
///
/// ```rust,no_run
/// use ext_php_rs::embed::PhpThreadGuard;
///
/// std::thread::spawn(|| {
/// let _guard = PhpThreadGuard::new();
/// // ... execute PHP requests on this thread ...
/// });
/// ```