mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-20 20:50:44 +00:00
MEDIUM: threads/lua: Makes the jmpbuf and some other buffers local to the current thread.
The jmpbuf contains pointer on the stack memory address currently use when the jmpbuf is set. So the information is local to each thread. The struct field is too big to put it in the stack, but it is used as buffer for retriving stats values. So, this buffer si local to each threads. Each function using this buffer, use it whithout break (yield) so, the consistency of local buffer is ensured.
This commit is contained in:
parent
8ca3b4bc46
commit
ffbad79027
@ -98,7 +98,7 @@
|
||||
* because they must be exists in the program stack when the longjmp
|
||||
* is called.
|
||||
*/
|
||||
jmp_buf safe_ljmp_env;
|
||||
THREAD_LOCAL jmp_buf safe_ljmp_env;
|
||||
static int hlua_panic_safe(lua_State *L) { return 0; }
|
||||
static int hlua_panic_ljmp(lua_State *L) { longjmp(safe_ljmp_env, 1); }
|
||||
|
||||
|
@ -40,7 +40,7 @@ static int class_regex_ref;
|
||||
|
||||
#define STATS_LEN (MAX((int)ST_F_TOTAL_FIELDS, (int)INF_TOTAL_FIELDS))
|
||||
|
||||
static struct field stats[STATS_LEN];
|
||||
static THREAD_LOCAL struct field stats[STATS_LEN];
|
||||
|
||||
int hlua_checkboolean(lua_State *L, int index)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user