Skip to content

Commit 2fc8c14

Browse files
anthonylinehamcarlgsmith
authored andcommitted
Make sure RPC is tidied up when shared library is unloaded
When a LUA script uses the Apteryx LUA module it is possible for RPC messages to continue to arrive after the shared library has been unloaded as LUA doesn't know how to shutdown the module. This can lead to segment violations in LUA. A similar situation is possible via apteryx-xml. By flagging apteryx_shutdown_force as a destructor the RPC will be correctly shutdown as the shared library is unloaded.
1 parent 126dcab commit 2fc8c14

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

apteryx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#include "apteryx.h"
3535
#include <glib.h>
3636

37+
/* Flag the destructor so things get tidied up when the shared library is unloaded */
38+
bool apteryx_shutdown_force (void) __attribute__((destructor));
39+
3740
/* Configuration */
3841
bool apteryx_debug = false; /* Debug enabled */
3942
static const char *default_url = APTERYX_SERVER; /* Default path to Apteryx database */

0 commit comments

Comments
 (0)