lua-users home
lua-l archive

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


Francisco Sant'anna escribió:
Hello,

When the use of threads is required, what's the best option I have?
I found:
1 - www.cs.princeton.edu/~diego/professional/ <http://www.cs.princeton.edu/%7Ediego/professional/>*luathread*/
*2 - lua*51*pthread*.*lua*forge.net/ <http://forge.net/>
3 - luaforge.net/projects/ <http://luaforge.net/projects/>*luatask*/
I chose LuaTask because of its simplicity and straightforward use.

Also, I couldn't find an active LuaTask forum or list, sorry for posting here.

When a thread raises an error, how am I supposed to notice it?
I can use task.isrunning() but where's the error message?
In the simple example below I can never see the message "hello error".

-- t1.lua
require 'task'
task.create't2.lua'

-- t2.lua
error'hello error'

Thanks.

Hi Francisco,

There is a forum at http://luaforge.net/forum/forum.php?forum_id=203

About your example:
1) t1.lua (the main task) must do something after task.create() to avoid terminating the whole program.
   -- t1.lua
   require 'task'
   task.create't2.lua'
   task.receive( -1 ) -- main task blocked forever
2) The "error" function push the error message on the stack and terminates the pcall. LuaTask doesn't invoke a report function (message printing) as lua binary does, and you never see (or get) the message. You can replace "error" by "print" in t2.lua to successfully run your example.

Regards,
Daniel