jump_fcontext should set the outValue of fiber being switched to rather the one being switched from

Fixes #5162
This commit is contained in:
Marek Roszko 2020-08-25 19:58:28 -04:00 committed by Mark Roszko
parent 3b1f1f7b6a
commit cb013604a9
1 changed files with 1 additions and 2 deletions

View File

@ -1297,10 +1297,9 @@ fcontext_t LIBCONTEXT_CALL_CONVENTION make_fcontext(void* sp, size_t size, void(
intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext(fcontext_t* ofc, fcontext_t nfc, intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext(fcontext_t* ofc, fcontext_t nfc,
intptr_t vp, bool preserve_fpu) intptr_t vp, bool preserve_fpu)
{ {
auto current = (void*)GetCurrentFiber();
fiberParams[current].outValue = vp;
*ofc = GetCurrentFiber(); *ofc = GetCurrentFiber();
fiberParams[nfc].inValue = vp; fiberParams[nfc].inValue = vp;
fiberParams[nfc].outValue = vp;
SwitchToFiber(nfc); SwitchToFiber(nfc);
return fiberParams[*ofc].outValue; return fiberParams[*ofc].outValue;
} }