]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: lua-thread: Add the lua-load-per-thread directive
authorThierry Fournier <thierry.fournier@ozon.io>
Sat, 28 Nov 2020 23:37:41 +0000 (00:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Dec 2020 20:53:16 +0000 (21:53 +0100)
commit59f11be436d95b622760082d597679cf00e355f1
tree9a630936163cee079459db59dfc6ff664d0ddb48
parentc749259dff591b234a42e0ab825eed31f4943660
MEDIUM: lua-thread: Add the lua-load-per-thread directive

The goal is to allow execution of one main lua state per thread.

This patch contains the main job. The lua init is done using these
steps:
 - "lua-load-per-thread" loads the lua code in the first thread
 - it creates the structs
 - it stores loaded files
 - the 1st step load is completed (execution of hlua_post_init)
   and now, we known the number of threads
 - we initilize lua states for all remaining threads
 - for each one, we load the lua file
 - for each one, we execute post-init

Once all is loaded, we control consistency of functions references.
The rules are:
 - a function reference cannot be in the shared lua state and in
   a per-thread lua state at the same time.
 - if a function reference is declared in a per-thread lua state, it
   must be declared in all per-thread lua states
doc/configuration.txt
src/hlua.c