Skip to content

Commit

Permalink
code cleanup of task-stacks change
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 24, 2015
1 parent d5ecea3 commit 6453eca
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ void NOINLINE NORETURN restore_stack(jl_task_t *t, char *p)
unw_cursor_t unw_cursor;
if (unw_init_local(&unw_cursor, &t->ctx) != 0)
abort();
//if (unw_step(&unw_cursor) <= 0) // skip the rest of ctx_switch on return
// abort();
unw_resume(&unw_cursor);
#endif
abort();
Expand Down Expand Up @@ -360,11 +358,6 @@ static void ctx_switch(jl_task_t *t)
}
SwitchToFiber(t->fiber);
#else

#ifdef COPY_STACKS
save_stack(lastt); // also allocates lastt->ctx
#endif

#ifdef _OS_WINDOWS_
if (jl_setjmp(lastt->ctx, 0)) return; // store the old context
if (t->fiber != lastt->fiber) {
Expand All @@ -374,14 +367,12 @@ static void ctx_switch(jl_task_t *t)
t = jl_current_task;
}
#else
static JL_THREAD volatile uint8_t first;
first = 1;
unw_getcontext(&lastt->ctx); // store the old context
if (!first) return;
first = 0;
if (t != jl_current_task) return; // this is true iff we have just returned to this context
#endif

#ifdef COPY_STACKS
save_stack(lastt);
if (t != jl_root_task && t->stkbuf) {
// task already exists
restore_stack(t, NULL); // resume at jl_setjmp of the other thread after restoring the stack (doesn't return)
Expand Down Expand Up @@ -422,8 +413,6 @@ static void ctx_switch(jl_task_t *t)
unw_cursor_t unw_cursor;
if (unw_init_local(&unw_cursor, &t->ctx) != 0)
abort();
//if (unw_step(&unw_cursor) <= 0) // skip the rest of ctx_switch on return
// abort();
unw_resume(&unw_cursor); // (doesn't return)
abort();
#endif
Expand Down

0 comments on commit 6453eca

Please sign in to comment.