On Fri, Jun 29, 2012 at 8:39 AM, Anders Andersson <[email protected]> wrote:
>
> Since I use a lot of wxThreads in my application, I wonder what the status
> is of implementing wxThreads in wxLua? The last post I found about this was
> from 2010.

Currently the bindings are not written, see wxLua/bindings/wxwidgets
for the others.

> I know there is "coroutine" but again it's very slow and not like the real
> thing. I wonder what the problem is with implementing wxThreads? (im not
> familiar with wxLua code). I only use wxTHREAD_DETACHED, is it not just to
> write an interface for wxThread and let wxWidgets manage the rest?

I'm not sure offhand, writing the bindings is easy, but in this case a
wxLuaThread class would have to be written to call your Lua function
when Entry() is called, OnExit() called, and expose Exit().

The question is whether Lua can run them, I don't think the Lua stack
can do it out of the box and lua_lock() and lua_unlock() would have to
be written.

http://lua-users.org/wiki/ThreadsTutorial

Perhaps coroutines would work for you, the only limitation on them
with wxLua is that you cannot create an event callback in a coroutine,
but neither can you in a wxThread so it shouldn't matter. The downside
is that in a coroutine you have to manage timeslicing.

It sounds you have a C++ app? If so, one possibility is to keep the
threads in C++ and use wxLua for other parts using wxPostEvent for
communication.

Regards,
     John

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to