From 5f4a47b70125c1f5ca0e6e6a72774a94ddbc0b37 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 31 Oct 2017 15:59:32 +0100 Subject: [PATCH] CLEANUP: threads: replace the last few 1UL<runq != &applet_active_queue) { next = LIST_NEXT(&curr->runq, typeof(next), runq); - if (curr->process_mask & (1UL << tid)) { + if (curr->process_mask & tid_bit) { LIST_DEL(&curr->runq); curr->state = APPLET_RUNNING; LIST_ADDQ(&applet_cur_queue, &curr->runq); diff --git a/src/flt_spoe.c b/src/flt_spoe.c index 938faabd25..cdb6238f82 100644 --- a/src/flt_spoe.c +++ b/src/flt_spoe.c @@ -1949,7 +1949,7 @@ spoe_create_appctx(struct spoe_config *conf) memset(appctx->ctx.spoe.ptr, 0, pool2_spoe_appctx->size); appctx->st0 = SPOE_APPCTX_ST_CONNECT; - if ((SPOE_APPCTX(appctx)->task = task_new(1UL << tid)) == NULL) + if ((SPOE_APPCTX(appctx)->task = task_new(tid_bit)) == NULL) goto out_free_spoe_appctx; SPOE_APPCTX(appctx)->owner = appctx; diff --git a/src/hlua.c b/src/hlua.c index 6edb08a83b..4911204a53 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2510,7 +2510,7 @@ __LJMP static int hlua_socket_new(lua_State *L) lua_setmetatable(L, -2); /* Create the applet context */ - appctx = appctx_new(&update_applet, 1UL << tid); + appctx = appctx_new(&update_applet, tid_bit); if (!appctx) { hlua_pusherror(L, "socket: out of memory"); goto out_fail_conf; @@ -6165,7 +6165,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(1UL << tid); + task = task_new(tid_bit); if (!task) { SEND_ERR(px, "Lua applet tcp '%s': out of memory.\n", ctx->rule->arg.hlua_rule->fcn.name); @@ -6366,7 +6366,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(1UL << tid); + task = task_new(tid_bit); if (!task) { SEND_ERR(px, "Lua applet http '%s': out of memory.\n", ctx->rule->arg.hlua_rule->fcn.name); @@ -6911,7 +6911,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(1UL << tid); + appctx->ctx.hlua_cli.task = task_new(tid_bit); if (!appctx->ctx.hlua_cli.task) { SEND_ERR(NULL, "Lua cli '%s': out of memory.\n", fcn->name); goto error; diff --git a/src/task.c b/src/task.c index 0022bff302..7623da9596 100644 --- a/src/task.c +++ b/src/task.c @@ -229,7 +229,7 @@ void process_runnable_tasks() while (local_tasks_count < 16) { t = eb32_entry(rq_next, struct task, rq); rq_next = eb32_next(rq_next); - if (t->process_mask & (1UL << tid)) { + if (t->process_mask & tid_bit) { /* detach the task from the queue */ __task_unlink_rq(t); t->state |= TASK_RUNNING; -- 2.47.3