libcontext: clean up own's shit when coroutine call is over (MSVC only)
This commit is contained in:
parent
637571e0be
commit
151b4e4e5e
|
@ -92,6 +92,13 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
~CALL_CONTEXT()
|
||||
{
|
||||
if ( m_mainStackContext )
|
||||
libcontext::release_fcontext( *m_mainStackContext );
|
||||
}
|
||||
|
||||
|
||||
void SetMainStack( CONTEXT_T* aStack )
|
||||
{
|
||||
m_mainStackContext = aStack;
|
||||
|
@ -161,6 +168,10 @@ public:
|
|||
#ifdef KICAD_USE_VALGRIND
|
||||
VALGRIND_STACK_DEREGISTER( valgrind_stack );
|
||||
#endif
|
||||
if(m_caller)
|
||||
libcontext::release_fcontext( m_caller );
|
||||
if(m_callee)
|
||||
libcontext::release_fcontext( m_callee );
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -1305,10 +1305,43 @@ intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext(fcontext_t* ofc, fcontext_t nf
|
|||
return fiberParams[*ofc].outValue;
|
||||
}
|
||||
|
||||
|
||||
void LIBCONTEXT_CALL_CONVENTION release_fcontext( fcontext_t ctx )
|
||||
{
|
||||
if( fiberParams.find( ctx ) != fiberParams.end() )
|
||||
{
|
||||
fiberParams.erase( ctx );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}; // namespace libcontext
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#else // defined(LIBCONTEXT_PLATFORM_msvc_x86_64) || defined(LIBCONTEXT_PLATFORM_msvc_i386)
|
||||
|
||||
#warning nowindows
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
namespace libcontext
|
||||
{
|
||||
|
||||
void LIBCONTEXT_CALL_CONVENTION release_fcontext( fcontext_t ctx )
|
||||
{
|
||||
// do nothing...
|
||||
}
|
||||
|
||||
}; // namespace libcontext
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif // defined(LIBCONTEXT_PLATFORM_msvc_x86_64) || defined(LIBCONTEXT_PLATFORM_msvc_i386)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ typedef void* fcontext_t;
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void LIBCONTEXT_CALL_CONVENTION release_fcontext( fcontext_t ctx );
|
||||
|
||||
intptr_t LIBCONTEXT_CALL_CONVENTION jump_fcontext( fcontext_t* ofc, fcontext_t nfc,
|
||||
intptr_t vp, bool preserve_fpu = true );
|
||||
|
|
Loading…
Reference in New Issue