lua-users home
lua-l archive

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


If you are talking about client, I don't see the need
for coroutine nor thread. Sounds pretty sequential to
me. Unless you want it to handle all these events
simultaneously(and each task can potentially take a
very long time and the other events cannot wait).

If they are relatively independent and the number of
cocurrent event is small, I would say LuaThread as
that is easier to code.

--- Pete Kay <petedao@gmail.com> wrote:

> Hi,
> 
> I am working on an application that connects to a
> server through TCP/IP
> socket and listen for events continuously.  When a
> certain event is picked
> up, the application should performance some tasks.
> 
> What I want to do is to use Lua socket to listen for
> the events and then
> create a new thread each time a particular event
> type is received.
> 
> I found that there are two ways to do it, one is
> using coroutine and the
> other one is to install Lua Thread.
> 
> It seems like they are very similar but I don't
> quite understand when it is
> better to us coroutine or LuaThread.
> 
> Could someone give me some suggestions?
> 
> Thanks,
> Pete
>