Re: Patch - Fix for cross thread instantation when using wrap base.

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1272340752.1548.65.camel@octavo>
On Mon, 2010-04-26 at 09:47 +0200, Daniel Wallin wrote:
<snip>
> Thanks for figuring this out.
My pleasure.
> 
> I'm wondering if it wouldn't be simpler and more efficient to add a
> constructor to weak_ref et al. that takes the lua_State* of the main
> thread. That would avoid doing all this stack moving and get rid of the
> two extra API calls. Thoughts?

Do you mean that the code should create class instances in the main
thread from the get go, regardless of what thread started the process?  
I originally thought of doing this, but made a bit of a mess while
trying and switched tack (thank you git-branch!!).  I'm still figuring
out how the code works. ;-)

On another note, in the bits of code I wrote, I'm wondering if the
second lua_xmove could be replaced simply by lua_pop.  Is this value
needed on the thread's stack afterwards?

Nigel


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.