lua-users home
lua-l archive

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


Multi threading tends to get ugly so I would advise avoiding that if you can. The way I tend to do it correlates somewhat to a Windows message loop where nothing happens until an event is fired, and the next one won't fire until the current one returns.

Barring that, you may wish to look into the lua_lock and lua_unlock macros, which you may be able to #define to get you where you need to be.

Matthew P. Del Buono

Sent from my Verizon Wireless BlackBerry


From: RJP Computing
Date: Mon, 1 Jun 2009 21:21:13 -0400
To: Lua list<lua@bazar2.conectiva.com.br>
Subject: Re: Lua Event driven programming

On Mon, Jun 1, 2009 at 6:43 PM, Phoenix Sol <phoenix@burninglabs.com> wrote:
On Jun 1, 2009, at 2:35 PM, Linker <linker.m.lin@gmail.com> wrote:

Hi,
�Event-driven is no a good choice for lua programming.Coroutine is a better choice.

I'm no computer scientist, but I think that event loops and coroutines can be used together quite nicely.

Hi,

I have been reading this post and hopping for a small example. Can someone explain if I have a C[++] thread that fires an event to Lua how it can "hook-up" in a thread safe way to the event? I would be fine with what ever work. No matter if it is coroutine or callbacks. I know the particular library I am trying to wrap uses callbacks, but the events can happen anytime. I tried to just call a registered Lua function, but I had thread safty issues because the event got fired while the main part of the script was running.
--
Regards,
Ryan