소스 검색

Reapply idempotent atexit patch;

bjorn 4 년 전
부모
커밋
d60277cc2e
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      enet.c

+ 6 - 1
enet.c

@@ -772,9 +772,14 @@ static const struct luaL_Reg enet_event_funcs [] = {
 	{NULL, NULL}
 };
 
+static int initialized = 0;
+
 int luaopen_enet(lua_State *l) {
 	enet_initialize();
-	atexit(enet_deinitialize);
+  if (!initialized) {
+    initialized = 1;
+    atexit(enet_deinitialize);
+  }
 
 	// create metatables
 	luaL_newmetatable(l, "enet_host");