Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Commit

Permalink
fix inability to run gc, highlighted by polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe committed Nov 26, 2015
1 parent d20be18 commit d11cc41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion classes/worker.h
Expand Up @@ -165,7 +165,7 @@ static zend_bool pthreads_worker_running_function(zend_object *std, zval *value)
zend_bool result = 0;

if (pthreads_monitor_lock(worker->monitor)) {
if (worker->running) {
if (*worker->running) {
running = PTHREADS_FETCH_FROM(*worker->running);
checking = PTHREADS_FETCH_FROM(Z_OBJ_P(value));

Expand Down
11 changes: 6 additions & 5 deletions src/stack.c
Expand Up @@ -226,23 +226,24 @@ zend_long pthreads_stack_collect(zend_object *std, pthreads_stack_t *stack, pthr
pthreads_monitor_state_t pthreads_stack_next(pthreads_stack_t *stack, zval *value, zend_object **running) {
pthreads_monitor_state_t state = PTHREADS_MONITOR_RUNNING;
if (pthreads_monitor_lock(stack->monitor)) {
#define SET_RUNNING_TO(t) *running = t
do {
if (!stack->head) {

if (pthreads_monitor_check(stack->monitor, PTHREADS_MONITOR_JOINED)) {
state = PTHREADS_MONITOR_JOINED;
SET_RUNNING_TO(NULL);
break;
}


SET_RUNNING_TO(NULL);
pthreads_monitor_wait(stack->monitor, 0);
} else {
pthreads_stack_remove(stack, stack->head, value, PTHREADS_STACK_GARBAGE);
*running =
Z_OBJ_P(value);
SET_RUNNING_TO(Z_OBJ_P(value));
break;
}
} while (state != PTHREADS_MONITOR_JOINED);
#undef SET_RUNNING_TO
pthreads_monitor_unlock(stack->monitor);
}

Expand Down

0 comments on commit d11cc41

Please sign in to comment.