开发者

Link multiple instances of same shared library into JVM

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 m开发者_如何学JAVAore 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.


The idea of a shared library is just to share a common code segment among multiple applications.

Once you realized this basic fact, you'd realize that what you're trying to do doesn't makes sense. Because the memory allocation will be within your process space.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜