Skip to content

Commit

Permalink
Merge branch 'main' into 0.3x
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Apr 13, 2023
2 parents 33dda11 + de3281f commit ed1b5fb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require": {
"php": ">7.4",
"ext-ffi": "*",
"symplely/zend-ffi": "~0.12.5"
"symplely/zend-ffi": "~0.12.7"
},
"autoload": {
"files": [
Expand Down
2 changes: 1 addition & 1 deletion preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function uv_ffi_loader()
$version = \trim((string) $os['VERSION_ID']);
if ($id === 'debian') {
$code = $directory . 'headers/uv_ubuntu' . ((float)$version < 20.04 ? '18.04' : '20.04') . '.h';
} elseif ($id === 'redhat') {
} elseif ($id === 'redhat' || $id === 'fedora') {
$code = $directory . 'headers/uv_centos' . ((float)$version < 8 ? '7' : '8+') . '.h';
}
}
Expand Down
41 changes: 21 additions & 20 deletions src/UVHandles.php
Original file line number Diff line number Diff line change
Expand Up @@ -1475,36 +1475,37 @@ public static function init(...$arguments)
$work_cb = \array_shift($arguments);
$after_cb = \array_shift($arguments);
$work = new static('struct uv_work_s');
\zval_add_ref($work);
$r = \uv_ffi()->uv_queue_work(
$loop(),
$work(),
function (CData $req) use ($work_cb) {
// $tsrm_ls = \ze_ffi()->ts_resource_ex(0, null);
//$tsrm_ls = \ze_ffi()->tsrm_new_interpreter_context();
//$old = \ze_ffi()->tsrm_set_interpreter_context($tsrm_ls);
require_once 'vendor/symplely/zend-ffi/preload.php';
if (\IS_PHP8) {
\ze_ffi()->ts_resource_ex(0, null);
\tsrmls_cache_update();
} else {
$tsrm_ls = \ze_ffi()->tsrm_new_interpreter_context();
$old = \ze_ffi()->tsrm_set_interpreter_context($tsrm_ls);
}

// \zend_pg('expose_php', 0);
// \zend_pg('auto_globals_jit', 0);
\zend_pg('expose_php', 0);
\zend_pg('auto_globals_jit', 1);

// \ze_ffi()->php_request_startup();
// \zend_eg('current_execute_data', null);
// \zend_eg('current_module', $phpext_uv_ptr);
\ze_ffi()->php_request_startup();

// require_once 'vendor/symplely/zend-ffi/preload.php';
// $work_cb();
\zend_eg('current_execute_data', null);
$work_cb();

//\ze_ffi()->php_request_shutdown(NULL);
// \ze_ffi()->ts_free_thread();
// \ze_ffi()->tsrm_set_interpreter_context($old);
// \ze_ffi()->tsrm_free_interpreter_context($tsrm_ls);
if (\IS_PHP8) {
\ze_ffi()->ts_free_thread();
} else {
\ze_ffi()->tsrm_set_interpreter_context($old);
\ze_ffi()->tsrm_free_interpreter_context($tsrm_ls);
}
},
function (CData $req, int $status) use ($after_cb, $work) {
// $after_cb($status);
// unset($status);
// \FFI::free($req);
// \zval_del_ref($after_cb);
// \zval_del_ref($work);
$after_cb($status);
\zval_del_ref($work);
}
);

Expand Down

0 comments on commit ed1b5fb

Please sign in to comment.