The goal is to emulate multi-threaded behavior for a .so which is not thread-safe. Memory is plentiful, not a problem. What is important for me is down-calls via JNI. What is not important is up-calls and sharing anything between .so instances (the goal is complete isolation).
I have heard that it is possible to link a shared lib more than once, but I have not seen anyone actually do it.
There is an opinion that doing this is a bad idea, but I am not convinced by the argument.
Is this a good/bad idea, and why?
If this turns out to be a good idea under certain conditions, where can I read more about it? Can anyone share some code that does this?
Let me add that making .so thread-safe is not really an option, and that mutex is the current implementation which I am trying to improve.