ruby: fix deadlock on df exit due to BEGIN_UNLOAD + Core.Suspend()

develop
jj 2012-06-25 19:16:35 +02:00
parent 412e8608d8
commit c2c29af959
2 changed files with 5 additions and 2 deletions

@ -116,7 +116,8 @@ To register ruby code to be run every graphic frame, use:
To stop being called, use: To stop being called, use:
df.onupdate_unregister handle df.onupdate_unregister handle
The same mechanism is available for 'onstatechange'. The same mechanism is available for 'onstatechange', but the
SC_BEGIN_UNLOAD event is not propagated to the ruby handler.
C++ object manipulation C++ object manipulation

@ -181,7 +181,9 @@ DFhackCExport command_result plugin_onstatechange ( color_ostream &out, state_ch
SCASE(MAP_UNLOADED); SCASE(MAP_UNLOADED);
SCASE(VIEWSCREEN_CHANGED); SCASE(VIEWSCREEN_CHANGED);
SCASE(CORE_INITIALIZED); SCASE(CORE_INITIALIZED);
SCASE(BEGIN_UNLOAD); // if we go through plugin_eval at BEGIN_UNLOAD, it'll
// try to get the suspend lock and deadlock at df exit
case SC_BEGIN_UNLOAD : return CR_OK;
#undef SCASE #undef SCASE
} }