Menu

#3 LibusbJava can only be used with a gatekeeper thread

open
nobody
3
2012-12-06
2012-04-11
uniederer
No

The current implementation of the wrapper stores various information retrieved from the Java environment using the interface pointer. (e.g. function IDs, class IDs, etc.) According to http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/design.html#wp16696 you must not share the interface pointer among different java threads. However it is guaranteed, you'll get the same interface pointer when multiple calls are made by the same thread.

As a consequence, you can use a gatekeeper thread to avoid calling LibusbJava from different thread contexts. However, it would be more practical to have a thread safe implementation here.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.