zipped the coroutine init code

This commit is contained in:
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");
}
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

View File

@ -1629,16 +1629,7 @@ main(int argc, char **argv){
// Coroutines
//
linuxvars.coroutine_free = linuxvars.coroutine_data;
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);
}
coroutines_init();
//
// X11 init

View File

@ -1065,14 +1065,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
// Coroutines
//
{
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);
}
coroutines_init();
//
// Window and GL Initialization