I asked about this before in issue tracker, but no one answered this question, so I closed that and asking here.
It seems possible to access lime’s CFFI functions from multiple threads, but doing this may lead to unexpected behavior because they are accessing global variables without locks or memory barriers. It might be very rare to happen, but it will happen I guess.
I think that moving all val_id initialization to one place will solve this problem, though this would need lots of refactoring.
val_id also doesn’t seem to be thread safe, at least on hxcpp. It’s also accessing global variables without locks.