lua-users home
lua-l archive

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



I don't believe it's that simple..

pthread nor _beginthreadex() will hardly disqualify a stack size for being too low. It's only later, when running one's program that awkward events would take place. Most likely, C libraries would be the ones taking most stack; Lua stack usage (recursion levels, and C automatic variables) should be pretty dependaple. Remember that the _Lua_ stack is kept in heap, and not affected.

So, my solution in Lua Lanes was to pick "suitable" stack sizes for all major OS'es. The script, nor the end user, has no way or need to modify them. Without recompiling, that is. Giving that freedom would in theory be "nice" but I think in practise it really wouldn't help much. Current defaults are about "twice as much as seems to be needed", to have some overhead.

Better ideas of course considered. :)

-asko


Duck kirjoitti 27.6.2007 kello 8:00:

Since this implies a LuaTask 1.6.1 some time in the not-too-distant future, how about adding an optional third param to task.create() allowing a stack size to be specified?


(You could add a new error code, say -5, for "stack size out of range" in case pthreads or _beginthreadex() doesn't like the size, e.g. it's too small, or just re-use error -4 in this case.)