[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua Event driven programming
- From: delbu9c1@...
- Date: Tue, 2 Jun 2009 15:06:52 +0000
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<email@example.com>
Subject: Re: Lua Event driven programming
On Mon, Jun 1, 2009 at 6:43 PM, Phoenix Sol <firstname.lastname@example.org>
I'm no computer scientist, but I think that event loops and coroutines can be used together quite nicely.
On Jun 1, 2009, at 2:35 PM, Linker <email@example.com
�Event-driven is no a good choice for lua programming.Coroutine is a better choice.
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.