From f154e1f1b6cea07163f364986fb11ccfcb87c3ad Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 21 Nov 2012 21:06:19 +0100 Subject: fix application shutdown crash by not registering anything with atexit() --- src/keeper.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/keeper.h') diff --git a/src/keeper.h b/src/keeper.h index a9b5a22..decae4a 100644 --- a/src/keeper.h +++ b/src/keeper.h @@ -8,7 +8,16 @@ struct s_Keeper //int count; }; +// if enabled, call close_keepers at the very last as we want to be sure no thread is GCing after. +// (and therefore may perform linda object dereferencing after keepers are gone) +// problem: maybe on some platforms (linux) atexit() is called after DLL/so are unloaded... +#define HAVE_KEEPER_ATEXIT_DESINIT 0 + char const* init_keepers( int const _nbKeepers, lua_CFunction _on_state_create); +#if !HAVE_KEEPER_ATEXIT_DESINIT +void close_keepers( void); +#endif // HAVE_KEEPER_ATEXIT_DESINIT + void populate_keepers( lua_State *L); struct s_Keeper *keeper_acquire( const void *ptr); void keeper_release( struct s_Keeper *K); -- cgit v1.2.3-55-g6feb