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.
diff --git a/src/hlua.c b/src/hlua.c
index d5d07de..8175056 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -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); }
 
diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
index a5cae86..a4adb21 100644
--- a/src/hlua_fcn.c
+++ b/src/hlua_fcn.c
@@ -40,7 +40,7 @@
 
 #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)
 {