Re: How to create another lua_State in pthread?

  • From: Hiroaki Nakamura <hnakamur@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 25 Jan 2013 04:24:55 +0900

Hi, thank you for your instruction.

I tried to typedef lua_State at
https://github.com/hnakamur/luajit-samples/blob/master/pthread/lobject.lua
but got an error:
luajit: lobject.lua:288: size of C type is unknown or too large at line 167
stack traceback:
        [C]: in function 'cdef'
        lobject.lua:288: in main chunk
        [C]: at 0x00404180

Could you tell me how can I fix this?
Thanks.

2013/1/24 Mike Pall <mike-1301@xxxxxxxxxx>:
> 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
>



-- 
中村 弘輝 )Hiroaki Nakamura) hnakamur@xxxxxxxxx

Other related posts: