Hi Adis,

On 10/17/2017 05:41 PM, Adis Nezirovic wrote:
> Hello guys,
> 
> After this commit:
> 
>   commit 0194897e540cec67d7d1e9281648b70efe403f08
>   Author: Emeric Brun <eb...@haproxy.com>
>   Date:   Thu Mar 30 15:37:25 2017 +0200
> 
>       MAJOR: task: task scheduler rework.
> 
> basic Lua tasks don't work anymore.
> e.g. this only gets called once:
> 
>   function cron()
>       while true do
>           core.Debug("Hello from Cron")
>           core.sleep(1)
>       end
>   end
>   core.register_task(cron)
> 
> ----
> 
> The current code in task_wakeup() checks for TASK_RUNNING and decides
> that it won't call __task_wakeup(), but when Lua task wakes up, it has
> both, TASK_WOKEN_TIMER and TASK_RUNNING set.
> 
> My quick fix/workaround was to add an additional check:
> 
>   if (unlikely(!(t->state & TASK_WOKEN_TIMER) &&
>                (t->state & TASK_RUNNING)))
> 
> But I might be missing something more fundamental (i.e. this is really
> necessary for multithreaded stuff), maybe we need additional flags when
> running task_wakeup from task handlers or threads.
> 
> 
> Best regards,
> Adis
> 

I'm adding the haproxy's LUA engine maintainer in CC, Thierry.

He should be helpful.

R,
Emeric

Reply via email to