|
On 12/8/06, Rici Lake <lua@ricilake.net> wrote:
If there is something else which you need to do to release resources, then you would have to keep track of the thread which acquired the resource yourself; you could then maintain a list of resources to be released per thread and add to the appropriate list when your __gc metamethod triggers (unless it happens to be running in the correct thread). Of course, you'd need to figure out some mechanism to ensure that the threads did run the release list, possibly in lua_lock().
Thanks, I think this is what I will end up doing. As the items are collected they will be stuffed into a table for later collection by the proper thread. Still seems like just working around the problem though because it will be easier to introduce bugs into this design due to it working at the wrong level in the system. CR