mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-07 22:12:08 +00:00
MEDIUM: threads/lua: Ensure that the launched tasks runs on the same threads than me
The applet manipulates the session and its buffers. We have two methods for ensuring that the memory of the session will not change during its manipulation by the task: 1 - adding mutex 2 - running on the same threads than the task. The second point is smart because it cannot lock the execution of another thread.
This commit is contained in:
parent
61ba0e2b6d
commit
4325ab727c
@ -2407,7 +2407,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
/* Create the applet context */
|
||||
appctx = appctx_new(&update_applet, MAX_THREADS_MASK);
|
||||
appctx = appctx_new(&update_applet, 1UL << tid);
|
||||
if (!appctx) {
|
||||
hlua_pusherror(L, "socket: out of memory");
|
||||
goto out_fail_conf;
|
||||
@ -6062,7 +6062,7 @@ static int hlua_applet_tcp_init(struct appctx *ctx, struct proxy *px, struct str
|
||||
ctx->ctx.hlua_apptcp.flags = 0;
|
||||
|
||||
/* Create task used by signal to wakeup applets. */
|
||||
task = task_new(MAX_THREADS_MASK);
|
||||
task = task_new(1UL << tid);
|
||||
if (!task) {
|
||||
SEND_ERR(px, "Lua applet tcp '%s': out of memory.\n",
|
||||
ctx->rule->arg.hlua_rule->fcn.name);
|
||||
@ -6263,7 +6263,7 @@ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct st
|
||||
ctx->ctx.hlua_apphttp.flags |= APPLET_HTTP11;
|
||||
|
||||
/* Create task used by signal to wakeup applets. */
|
||||
task = task_new(MAX_THREADS_MASK);
|
||||
task = task_new(1UL << tid);
|
||||
if (!task) {
|
||||
SEND_ERR(px, "Lua applet http '%s': out of memory.\n",
|
||||
ctx->rule->arg.hlua_rule->fcn.name);
|
||||
@ -6808,7 +6808,7 @@ static int hlua_cli_parse_fct(char **args, struct appctx *appctx, void *private)
|
||||
* We use the same wakeup fonction than the Lua applet_tcp and
|
||||
* applet_http. It is absolutely compatible.
|
||||
*/
|
||||
appctx->ctx.hlua_cli.task = task_new(MAX_THREADS_MASK);
|
||||
appctx->ctx.hlua_cli.task = task_new(1UL << tid);
|
||||
if (!appctx->ctx.hlua_cli.task) {
|
||||
SEND_ERR(NULL, "Lua cli '%s': out of memory.\n", fcn->name);
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user