diff options
Diffstat (limited to 'testing/uwsgi/lua-lock.patch')
-rw-r--r-- | testing/uwsgi/lua-lock.patch | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/testing/uwsgi/lua-lock.patch b/testing/uwsgi/lua-lock.patch deleted file mode 100644 index 059e8e9694..0000000000 --- a/testing/uwsgi/lua-lock.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c -index 6a2a2a9..692c4ef 100644 ---- a/plugins/lua/lua_plugin.c -+++ b/plugins/lua/lua_plugin.c -@@ -291,6 +291,57 @@ static int uwsgi_api_req_fd(lua_State *L) { - return 1; - } - -+static int uwsgi_api_lock(lua_State *L) { -+ -+ int lock_num = 0; -+ -+ // the spooler cannot lock resources -+#ifdef UWSGI_SPOOLER -+ if (uwsgi.i_am_a_spooler) { -+ lua_pushstring(L, "The spooler cannot lock/unlock resources"); -+ lua_error(L); -+ } -+#endif -+ -+ if (lua_gettop(L) > 0) { -+ lock_num = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : -1; -+ if (lock_num < 0 || lock_num > uwsgi.locks) { -+ lua_pushstring(L, "Invalid lock number"); -+ lua_error(L); -+ } -+ } -+ -+ uwsgi_lock(uwsgi.user_lock[lock_num]); -+ -+ return 0; -+} -+ -+ -+static int uwsgi_api_unlock(lua_State *L) { -+ -+ int lock_num = 0; -+ -+ // the spooler cannot lock resources -+#ifdef UWSGI_SPOOLER -+ if (uwsgi.i_am_a_spooler) { -+ lua_pushstring(L, "The spooler cannot lock/unlock resources"); -+ lua_error(L); -+ } -+#endif -+ -+ if (lua_gettop(L) > 0) { -+ lock_num = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : -1; -+ if (lock_num < 0 || lock_num > uwsgi.locks) { -+ lua_pushstring(L, "Invalid lock number"); -+ lua_error(L); -+ } -+ } -+ -+ uwsgi_unlock(uwsgi.user_lock[lock_num]); -+ -+ return 0; -+} -+ - static const luaL_reg uwsgi_api[] = { - {"log", uwsgi_api_log}, - {"cl", uwsgi_api_cl}, -@@ -300,6 +351,8 @@ static const luaL_reg uwsgi_api[] = { - {"cache_set", uwsgi_api_cache_set}, - {"register_signal", uwsgi_api_register_signal}, - {"register_rpc", uwsgi_api_register_rpc}, -+ {"lock", uwsgi_api_lock}, -+ {"unlock", uwsgi_api_unlock}, - {NULL, NULL} - }; - |