Re: How to create another lua_State in pthread?

  • From: Henk Boom <henk@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 23 Jan 2013 10:39:15 -0500

This is the approach I took. I couldn't find a way to get the returned
callback through the lua API, so instead I passed a void*(*[1])(void*)
to the new state as a lightuserdata that it could write the function
pointer into. Other than that, it seems to work without any fuss! :)


On 23 January 2013 10:21, Mike Pall <mike-1301@xxxxxxxxxx> wrote:
> Hiroaki Nakamura wrote:
>> How can we write that? Do we have to write that portion in C?
>> Or we can write the function called from pthread_create() in lua?
> You create a separate Lua state first, then define a callback
> function in *that* state and then use pthread_create() from the
> original state, passing the callback address of the other state.
> --Mike

Other related posts: