lua-users home
lua-l archive

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


On Friday, March 10, 2006 4:47 PM, Javier Guerra wrote:


> It's there:
>
> http://luaforge.net/projects/helper-threads/

Looks squeaky clean. Have not played with it yet though.

There are some use cases that I don't understand how I could handle
using this package.

I have C++ tasks (that I wish I could make them invocable from Lua)
that can be canceled or it's state updated from one or more tasks.

For example I have a task to stream a live audio file (that is being
recorded by another task). The streaming task basically sits in a
loop reading the audio file and sending it out to the network; when
it hits EOF condition it checks a member variable that indicates if
the audio file is live (i.e still being recorded) or not. If live it
will yield a little while and then continue reading the file.

Meanwhile the recording task sends a message ('application event')
when it is done recording  to the streaming task which in turn sets
the member variable (_is_live) to false which in turn will make the
streaming task to quit the loop on the next EOF condition.

There is also another use case where yet another task may just ask
the streaming task to quit.

In the scheme that you have designed, 'cancel' and
'update_live_state' would be methods of the streaming task. Am I on
the right track?

Cheers
Vijay Aswadhati