lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Aug 11, 2014 6:07 PM, "Jay Carlson" <nop@nop.com> wrote:
>
> On Aug 11, 2014 1:48 PM, "Thiago L." <fakedme@gmail.com> wrote:
>
> > On 11/08/14 02:34 PM, Jay Carlson wrote:
>
> >> Why do people like MediaWiki disable coroutines, anyway?
> >
> > Because you can't interrupt running coroutines?
> >
> > coroutine.resume(coroutine.create(function() while true do end end)) -- good luck interrupting me
>
> OK, that's a good reason. (OTOH, if you were going to tear down the runtime in response to an interrupt I'm not sure it matters.)

In this context, coroutine.resume is a fancy pcall. If they are using debug hooks to "interrupt", then child threads inherit the hook from the parent:

http://www.lua.org/source/5.2/lstate.c.html#lua_newthread

If they mean signals, then that's just bad design with or without coroutines. [Actually, signals and hooks are both terrible for interrupting a user script. The only secure option is a separate process.]