Skip to content

Commit 47b989f

Browse files
committed
Added isBusy function
1 parent c4d6b0f commit 47b989f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ namespace async_postgres::lua {
241241
lua->PushBool(false);
242242
return 1;
243243
}
244+
245+
lua_protected_fn(isBusy) {
246+
lua->CheckType(1, async_postgres::connection_meta);
247+
auto state = lua_connection_state();
248+
lua->PushBool(state->reset_event ||
249+
state->query); // busy if reset or query are in progress
250+
return 1;
251+
}
244252
} // namespace async_postgres::lua
245253

246254
#define register_lua_fn(name) \
@@ -263,6 +271,7 @@ void register_connection_mt(GLua::ILuaInterface* lua) {
263271
register_lua_fn(reset);
264272
register_lua_fn(setNotifyCallback);
265273
register_lua_fn(wait);
274+
register_lua_fn(isBusy);
266275

267276
async_postgres::register_misc_connection_functions(lua);
268277

0 commit comments

Comments
 (0)