[php-src] PR #15590: Add OPcache restart hook
| From: | realFlowControl | Date: | Mon, 26 Aug 2024 14:11:07 +0000 |
| Subject: | [php-src] PR #15590: Add OPcache restart hook | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28205@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15590
Author: realFlowControl
Hey folks,
adding to #15543 which allows access to OPcache shared globals, this hook will allow observing
extensions to observe the actual OPcache restart using this code snippet:
```C
void restart_hook(zend_accel_restart_reason reason)
{
printf("IT HAPPENED\n");
}
void call_during_minit() {
// assume you have the
opcache_handle available
void (**opcache_restart_hook)(zend_accel_restart_reason reason);
opcache_restart_hook = DL_FETCH_SYMBOL(opcache_handle,
"zend_accel_schedule_restart_hook");
// do proper error handling ;-)
*opcache_restart_hook = restart_hook;
}
```