zipped the coroutine init code

master
Allen Webster 2017-07-19 16:10:05 -04:00
parent e4a4608007
commit 5bb69d6d96
3 changed files with 12 additions and 18 deletions

View File

@ -140,5 +140,15 @@ read_command_line(i32 argc, char **argv){
LOG("Read command line.\n"); LOG("Read command line.\n");
} }
internal void
coroutines_init(){
init_coroutine_system(&coroutines);
umem size = COROUTINE_SLOT_SIZE*18;
void *mem = system_memory_allocate(size);
coroutine_system_provide_memory(&coroutines, mem, size);
coroutine_system_force_init(&coroutines, 4);
}
// BOTTOM // BOTTOM

View File

@ -1629,16 +1629,7 @@ main(int argc, char **argv){
// Coroutines // Coroutines
// //
linuxvars.coroutine_free = linuxvars.coroutine_data; coroutines_init();
for (i32 i = 0; i+1 < ArrayCount(linuxvars.coroutine_data); ++i){
linuxvars.coroutine_data[i].next = &linuxvars.coroutine_data[i + 1];
}
const size_t stack_size = MB(2);
for (i32 i = 0; i < ArrayCount(linuxvars.coroutine_data); ++i){
linuxvars.coroutine_data[i].stack.ss_size = stack_size;
linuxvars.coroutine_data[i].stack.ss_sp = system_memory_allocate(stack_size);
}
// //
// X11 init // X11 init

View File

@ -1065,14 +1065,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
// Coroutines // Coroutines
// //
{ coroutines_init();
init_coroutine_system(&coroutines);
umem size = COROUTINE_SLOT_SIZE*18;
void *mem = system_memory_allocate(size);
coroutine_system_provide_memory(&coroutines, mem, size);
coroutine_system_force_init(&coroutines, 4);
}
// //
// Window and GL Initialization // Window and GL Initialization