Commit 98f446d
committed
feat: expose thread API for Go-based PHP extensions
Add APIs that enable Go-based PHP extensions to execute on existing
FrankenPHP threads and access per-request state:
- Thread(index) — retrieves a PHP thread by its index, returning its
*http.Request which carries the request context
- PHPThread.Pin() — pins a Go object to prevent GC collection
- PHPThread.IsRequestDone() — checks if the request has been closed
- frankenphp_thread_index() — C function returning the current thread
index so C extension methods can call back into Go
This makes it possible to build PHP extensions where PHP calls into C,
C resolves the current thread index, and Go handles the logic with
full access to the request context.1 parent d26834c commit 98f446d
3 files changed
+38
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
1281 | 1285 | | |
1282 | 1286 | | |
1283 | 1287 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
131 | 163 | | |
132 | 164 | | |
133 | 165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
| 172 | + | |
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
| |||
0 commit comments