mirror of https://github.com/bjornbytes/lovr.git
Rename thread module init/destroy;
This commit is contained in:
parent
c63c49338a
commit
60a12a6b7e
|
@ -69,8 +69,8 @@ int luaopen_lovr_thread(lua_State* L) {
|
|||
luaL_register(L, NULL, lovrThreadModule);
|
||||
luax_registertype(L, "Thread", lovrThread);
|
||||
luax_registertype(L, "Channel", lovrChannel);
|
||||
if (lovrThreadInit()) {
|
||||
luax_atexit(L, lovrThreadDeinit);
|
||||
if (lovrThreadModuleInit()) {
|
||||
luax_atexit(L, lovrThreadModuleDestroy);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
static ThreadState state;
|
||||
|
||||
bool lovrThreadInit() {
|
||||
bool lovrThreadModuleInit() {
|
||||
if (state.initialized) return false;
|
||||
map_init(&state.channels);
|
||||
return state.initialized = true;
|
||||
}
|
||||
|
||||
void lovrThreadDeinit() {
|
||||
void lovrThreadModuleDestroy() {
|
||||
if (!state.initialized) return;
|
||||
const char* key;
|
||||
map_iter_t iter = map_iter(&state.channels);
|
||||
|
|
|
@ -22,8 +22,8 @@ typedef struct {
|
|||
bool running;
|
||||
} Thread;
|
||||
|
||||
bool lovrThreadInit();
|
||||
void lovrThreadDeinit();
|
||||
bool lovrThreadModuleInit();
|
||||
void lovrThreadModuleDestroy();
|
||||
struct Channel* lovrThreadGetChannel(const char* name);
|
||||
|
||||
Thread* lovrThreadCreate(int (*runner)(void*), const char* body);
|
||||
|
|
Loading…
Reference in New Issue