mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-09 20:42:33 +02:00
MEDIUM: threads/lua: Add locks around the Lua execution parts.
Note that the Lua processing is not really thread safe. It provides heavy system which consists to add our own lock function in the Lua code and recompile the library. This system will probably not accepted by maintainers of various distribs. Our main excution point of the Lua is the function lua_resume(). A quick looking on the Lua sources displays a lua_lock() a the start of function and a lua_unlock() at the end of the function. So I conclude that the Lua thread safe mode just perform a mutex around all execution. So I prefer to do this in the HAProxy code, it will be easier for distro maintainers. Note that the HAProxy lua functions rounded by the macro SET_SAFE_LJMP and RESET_SAFE_LJMP manipulates the Lua stack, so it will be careful to set mutex around these functions.
This commit is contained in:
committed by
Willy Tarreau
parent
ffbad79027
commit
61ba0e2b6d
@@ -165,6 +165,7 @@ enum lock_label {
|
||||
PATLRU_LOCK,
|
||||
VARS_LOCK,
|
||||
COMP_POOL_LOCK,
|
||||
LUA_LOCK,
|
||||
LOCK_LABELS
|
||||
};
|
||||
struct lock_stat {
|
||||
@@ -252,7 +253,7 @@ static inline void show_lock_stats()
|
||||
"LISTENER", "LISTENER_QUEUE", "PROXY", "SERVER",
|
||||
"UPDATED_SERVERS", "LBPRM", "SIGNALS", "STK_TABLE", "STK_SESS",
|
||||
"APPLETS", "PEER", "BUF_WQ", "STREAMS", "SSL", "SSL_GEN_CERTS",
|
||||
"PATREF", "PATEXP", "PATLRU", "VARS", "COMP_POOL" };
|
||||
"PATREF", "PATEXP", "PATLRU", "VARS", "COMP_POOL", "LUA" };
|
||||
int lbl;
|
||||
|
||||
for (lbl = 0; lbl < LOCK_LABELS; lbl++) {
|
||||
|
||||
Reference in New Issue
Block a user