[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Callback state management
- From: Javier Guerra <javier@...>
- Date: Sat, 4 Apr 2009 15:27:35 -0500
John Dunn wrote:
> I'm attempting to write an asynchronous library that uses callbacks. >From script, the callbacks look like
> ......
> Ignoring some big holes ( like I'll need to protect the lua_State when the callback comes back on another thread ) is there anything fundamentally wrong with the concept, or the following code?
what i did for HTT (Helper Threads Toolkit) is to create a queue where you can put the unfinished task, and a couple of functions to get the next finished task from the queue. that way, you can either block waiting for a task, or poll the queue.
HTT's purpose is to be a common foundation for asynchronous C libraries, so if you're not too far into your design, you might want to use it. it's on LuaForge: http://luaforge.net/projects/helper-threads/
--
Javier