usb4java/src
Luca Longinotti 275bc37a77 Right now if you add different PollfdListeners to different contexts, only the last one will be remembered, and subsequent callbacks, even from other contexts, will always use that last one.
This is obviously unexpected and incorrect, yet cannot be fixed by just adding more data on the C side: you'd have to remember the callback object at the very least, which you could in the user_data
field, but you'd have to make it a global reference. Yet, there would be no easy way to later correctly delete that global reference, since to unset the pollfdNotifiers you just pass NULL to the
same function again, and you don't get back any data on what was there before.
The easiest way to fix this was thus to change to a HashMap, Concurrent since access can be from random threads.
The key was chosen to be the Context.hashCode(), as Integer lookup and comparison is fast, and the hashCode depends directly on the contextPointer stored in the Context (which identifies it).
This works for sure on 32bit systems, but I'm still concerned about 64bit systems, where a long would probably make more sense, I need to think about it some more.
2013-06-12 13:38:10 +02:00
..
changes Prepare pom and site for release on sonatype repo 2013-05-01 11:00:36 +02:00
firmware/c Include full autoconf build system in repo 2013-04-30 21:03:08 +02:00
main Right now if you add different PollfdListeners to different contexts, only the last one will be remembered, and subsequent callbacks, even from other contexts, will always use that last one. 2013-06-12 13:38:10 +02:00
site Mention usb-api.jar in quickstart 2013-05-07 21:19:26 +02:00
test Right now if you add different PollfdListeners to different contexts, only the last one will be remembered, and subsequent callbacks, even from other contexts, will always use that last one. 2013-06-12 13:38:10 +02:00