lua-users home
lua-l archive

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


Daniel Quintela <dq@soongsoft.com> wrote
> It was my first solution, but I preferred to add the pointer indirection 
> to TASK_ENTRY blocks and keep its memory immutable.
> Threads don't have to worry about its own memory.
> Yes, it adds complexity and a level of indirection to access the task 
> list... ¿what is the better approach?.

Well, I just prefer to keep stuff as simple as possible. I have not yet
fully analysed your changes; possibly they'll make LuaTask more robust
than the old allocation scheme.

What I know is that the old scheme *in itself* worked fine. I checked
with a pre-allocated array of 2048 entries and I had not a single crash
in a few hours of stress-testing. The culprit was clearly the realloc()
and that's why I concentrated on the code in taskthread().

But I am glad that this fixed now because LuaTask is a simple, but
elegant solution to getting threads into Lua.

-- 
cheers  thomasl

web : http://thomaslauer.com/start