/* Tries to allocate a new appctx and initialize its main fields. The appctx
* is returned on success, NULL on failure. The appctx must be released using
- * appctx_free(). <applet> is assigned as the applet, but it can be NULL.
+ * appctx_free(). <applet> is assigned as the applet, but it can be NULL. The
+ * applet's task is always created on the current thread.
*/
-static inline struct appctx *appctx_new(struct applet *applet, unsigned long thread_mask)
+static inline struct appctx *appctx_new(struct applet *applet)
{
struct appctx *appctx;
appctx->obj_type = OBJ_TYPE_APPCTX;
appctx->applet = applet;
appctx_init(appctx);
- appctx->t = task_new(thread_mask);
+ appctx->t = task_new(tid_bit);
if (unlikely(appctx->t == NULL)) {
pool_free(pool_head_appctx, appctx);
return NULL;
struct appctx *appctx;
si_release_endpoint(si);
- appctx = appctx_new(applet, tid_bit);
+ appctx = appctx_new(applet);
if (appctx) {
si_attach_appctx(si, appctx);
appctx->t->nice = si_strm(si)->task->nice;
struct stream *s;
struct applet *applet = &dns_session_applet;
- appctx = appctx_new(applet, tid_bit);
+ appctx = appctx_new(applet);
if (!appctx)
goto out_close;
struct session *sess;
struct stream *strm;
- if ((appctx = appctx_new(&spoe_applet, tid_bit)) == NULL)
+ if ((appctx = appctx_new(&spoe_applet)) == NULL)
goto out_error;
appctx->ctx.spoe.ptr = pool_zalloc(pool_head_spoe_appctx);
lua_setmetatable(L, -2);
/* Create the applet context */
- appctx = appctx_new(&update_applet, tid_bit);
+ appctx = appctx_new(&update_applet);
if (!appctx) {
hlua_pusherror(L, "socket: out of memory");
goto out_fail_conf;
/* The HTTP client will be created in the same thread as the caller,
* avoiding threading issues */
- appctx = appctx_new(applet, tid_bit);
+ appctx = appctx_new(applet);
if (!appctx)
goto out;
peer->last_hdshk = now_ms;
s = NULL;
- appctx = appctx_new(&peer_applet, tid_bit);
+ appctx = appctx_new(&peer_applet);
if (!appctx)
goto out_close;
if (sft->srv->log_proto == SRV_LOG_PROTO_OCTET_COUNTING)
applet = &sink_forward_oc_applet;
- appctx = appctx_new(applet, tid_bit);
+ appctx = appctx_new(applet);
if (!appctx)
goto out_close;