MCPcopy Create free account
hub / github.com/Tencent/libco / save_stack_buffer

Function save_stack_buffer

co_routine.cpp:582–597  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582void save_stack_buffer(stCoRoutine_t* occupy_co)
583{
584 ///copy out
585 stStackMem_t* stack_mem = occupy_co->stack_mem;
586 int len = stack_mem->stack_bp - occupy_co->stack_sp;
587
588 if (occupy_co->save_buffer)
589 {
590 free(occupy_co->save_buffer), occupy_co->save_buffer = NULL;
591 }
592
593 occupy_co->save_buffer = (char*)malloc(len); //malloc buf;
594 occupy_co->save_size = len;
595
596 memcpy(occupy_co->save_buffer, occupy_co->stack_sp, len);
597}
598
599void co_swap(stCoRoutine_t* curr, stCoRoutine_t* pending_co)
600{

Callers 1

co_swapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected