lua-users home
lua-l archive

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


Well ok true, but any simple "execute a line, switch" would add horrible overhead (like slowing Lua by 2x-4x). So you then add smarter preempt, then you get worried about starvation, and priority … and you're on the way to building your own full-blown scheduler.

FWIW I think Lua DOES lack a "lua_step()" API that runs a VM for some count of instructions (or something similar) in an efficient manner, as this would make scheduling schemes within C pretty each to implement. However, having designed many schedulers over the years I'm not sure this guy is approaching this the right way.

--Tim

On Mar 28, 2013, at 8:58 PM, Ross Bencina <rossb-lists@audiomulch.com> wrote:

> On 29/03/2013 2:35 PM, Tim Hill wrote:
>> You're not going to be able to pull that one off. The fundamental
>> structure of coroutines is different from threads, and nothing you do
>> can really change that (aside from a VERY significant reworking of
>> the Lua code base).
> 
> I don't know about that, all he's talking about is conditionally injecting yeild() into the code at arbitrary points (such as the end of each statement)
> 
> This could be done manually with a syntactic substitution. The question is whether it can be done using a debug hook or similar mechanism.
> 
> Ross.
>