lua-users home
lua-l archive

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


Hello,
I am currently using luaproc in my video processing application, and i need now to exchange userdata between workers (ie threads) thru channels.
I use the "indirect" userdata mode, ie LUA userdata allocates a void* pointer, and this pointer receives the address of my internal C structure.

I plan to offer 2 modes for exchanging userdata with luaproc:
  • copy mode : This will perform a raw copy of the userdata content to the destination thread. There is no issue on that point right now.
  • move mode : This will allow the user to use a "zero copy" mechanism, by just moving the userdata content pointer to the destination thread. Of course, it means that the source thread does not need anymore the userdata. So i want to find a way to set the variable pointing to the userdata to 'nil', in order to unvalidate the userdata on the source side.
Do you have a proper method to perform this move mode ?

Thanks for you answers,

Rgds, SF