Skip to content

Commit

Permalink
make request_info from SAPI globals accessible in threads
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Jun 19, 2024
1 parent d8afc34 commit 7e02ef0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ zend_object* php_parallel_runtime_create(zend_class_entry *type) {
php_parallel_scheduler_init(runtime);

runtime->parent.server = SG(server_context);
runtime->parent.request_info = &SG(request_info);

return &runtime->std;
}
Expand Down
3 changes: 3 additions & 0 deletions src/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
| Author: krakjoe |
+----------------------------------------------------------------------+
*/
#include "SAPI.h"

#ifndef HAVE_PARALLEL_RUNTIME_H
#define HAVE_PARALLEL_RUNTIME_H

Expand All @@ -32,6 +34,7 @@ typedef struct _php_parallel_runtime_t {
} child;
struct {
void *server;
sapi_request_info *request_info;
} parent;
zend_llist schedule;
zend_object std;
Expand Down
1 change: 1 addition & 0 deletions src/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static zend_always_inline php_parallel_runtime_t* php_parallel_scheduler_setup(p
TSRMLS_CACHE_UPDATE();

SG(server_context) = runtime->parent.server;
SG(request_info) = *runtime->parent.request_info;

runtime->child.interrupt = &EG(vm_interrupt);

Expand Down

0 comments on commit 7e02ef0

Please sign in to comment.