aboutsummaryrefslogtreecommitdiff
path: root/src/keeper.c
diff options
context:
space:
mode:
authorBenoit Germain <bnt.germain@gmail.com>2012-11-21 21:06:19 +0100
committerBenoit Germain <bnt.germain@gmail.com>2012-11-21 21:06:19 +0100
commitf154e1f1b6cea07163f364986fb11ccfcb87c3ad (patch)
tree530495592fb8cf6300f5270626ced31a43c6313d /src/keeper.c
parent8c73ca05a8a6583844f7da90f3d8d1b2663a86a5 (diff)
downloadlanes-3.4.0.tar.gz
lanes-3.4.0.tar.bz2
lanes-3.4.0.zip
fix application shutdown crash by not registering anything with atexit()v3.4.0
Diffstat (limited to '')
-rw-r--r--src/keeper.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/keeper.c b/src/keeper.c
index b330d67..29f9c71 100644
--- a/src/keeper.c
+++ b/src/keeper.c
@@ -496,7 +496,11 @@ int keepercall_count( lua_State* L)
496static struct s_Keeper *GKeepers = NULL; 496static struct s_Keeper *GKeepers = NULL;
497static int GNbKeepers = 0; 497static int GNbKeepers = 0;
498 498
499static void atexit_close_keepers(void) 499#if HAVE_KEEPER_ATEXIT_DESINIT
500static void atexit_close_keepers( void)
501#else // HAVE_KEEPER_ATEXIT_DESINIT
502void close_keepers( void)
503#endif // HAVE_KEEPER_ATEXIT_DESINIT
500{ 504{
501 int i; 505 int i;
502 // 2-pass close, in case a keeper holds a reference to a linda bound to another keeoer 506 // 2-pass close, in case a keeper holds a reference to a linda bound to another keeoer
@@ -579,10 +583,9 @@ char const* init_keepers( int const _nbKeepers, lua_CFunction _on_state_create)
579 GKeepers[i].L = K; 583 GKeepers[i].L = K;
580 //GKeepers[i].count = 0; 584 //GKeepers[i].count = 0;
581 } 585 }
582 // call close_keepers at the very last as we want to be sure no thread is GCing after. 586#if HAVE_KEEPER_ATEXIT_DESINIT
583 // (and therefore may perform linda object dereferencing after keepers are gone)
584 // problem: maybe on some platforms atexit() is called after DLL/so are unloaded...
585 atexit( atexit_close_keepers); 587 atexit( atexit_close_keepers);
588#endif // HAVE_KEEPER_ATEXIT_DESINIT
586 return NULL; // ok 589 return NULL; // ok
587} 590}
588 591