future scheduling fix and tweak
- put an atomic action on the atomic queue, even if the future was locally suspended - try local allocation for a multiple-values buffer
This commit is contained in:
parent
7a47974a69
commit
275d4a7a05
|
@ -2354,6 +2354,11 @@ static void future_do_runtimecall(Scheme_Future_Thread_State *fts,
|
|||
future->rt_prim_is_atomic = is_atomic;
|
||||
future->status = WAITING_FOR_PRIM;
|
||||
|
||||
if (is_atomic) {
|
||||
future->next_waiting_atomic = fs->future_waiting_atomic;
|
||||
fs->future_waiting_atomic = future;
|
||||
}
|
||||
|
||||
if (fts->thread->current_ft) {
|
||||
if (insist_to_suspend) {
|
||||
/* couldn't capture the continuation locally, so ask
|
||||
|
@ -2361,9 +2366,6 @@ static void future_do_runtimecall(Scheme_Future_Thread_State *fts,
|
|||
future->next_waiting_lwc = fs->future_waiting_lwc;
|
||||
fs->future_waiting_lwc = future;
|
||||
future->want_lw = 1;
|
||||
} else if (is_atomic) {
|
||||
future->next_waiting_atomic = fs->future_waiting_atomic;
|
||||
fs->future_waiting_atomic = future;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,14 @@ static void allocate_values(int count, Scheme_Thread *p)
|
|||
static void ts_allocate_values(int count, Scheme_Thread *p) XFORM_SKIP_PROC
|
||||
{
|
||||
if (scheme_use_rtcall) {
|
||||
scheme_rtcall_allocate_values("[allocate_values]", FSRC_OTHER, count, p, allocate_values);
|
||||
/* try thread-local allocation: */
|
||||
Scheme_Object **a;
|
||||
a = MALLOC_N(Scheme_Object *, count);
|
||||
if (a) {
|
||||
p->values_buffer = a;
|
||||
p->values_buffer_size = count;
|
||||
} else
|
||||
scheme_rtcall_allocate_values("[allocate_values]", FSRC_OTHER, count, p, allocate_values);
|
||||
} else
|
||||
allocate_values(count, p);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user