lua-users home
lua-l archive

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

Brian Hook wrote:

But I have a related situation where the coroutine may need to be fired every now and then, e.g. every 10 seconds. Is the cost of the resume/yield pair high enough that the caller should check the interval:

Not even related to Lua, I would worry about cache misses in this
case. At least on older PC platforms i got into trouble when I tried
to implement something like this by calling (mostly) stub virtual functions
in C++.

Maybe something like a priority queue keyed with the next event time
would be optimal.