It’s similar stuff. I already don’t invoke Lua stuff on a thread, when I am invoking a callback, I do so on the main thread inside the update function.
But Defold’s internal stuff can be accessed in other threads, it’s just some things are not thread safe. Here I am creating a new buffer object at the same time when the engine creates other buffer objects.
if I could set up a mutex or precreate the buffer object on the main thread, that would solve the problem. But mutex has to be incorporated in the engine and I can’t easily precreate the buffer object, because it needs buffer size value, and I know the size only inside the thread when image is being loaded.
So if there is a way to resize the buffer object after creation, that would solve the issue. Or maybe there is some other smart solution. If not, I will have to rework my threading code to invoke dmBuffer::Create() on the main thread.