[BREAKGLASS] Append-only mirror of github.com/sparrowwallet/usb4java
Go to file
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
src 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
.gitignore Include full autoconf build system in repo 2013-04-30 21:03:08 +02:00
LICENSE.md Convert LICENSE.txt to LICENSE.md 2013-04-13 13:37:00 +02:00
pom.xml [maven-release-plugin] prepare for next development iteration 2013-05-04 12:24:48 +02:00
README.md Convert README.txt to markdown and integrate CI status graphic 2013-04-22 19:32:01 +02:00

usb4java

USB library for Java based on libusb 1.0

Copyright (C) 2011 Klaus Reimer k@ailis.de

See LICENSE.md for licensing information.

This library can be used to access USB devices in Java. It is based on the native libusb 1.0 shared library and reflects this API as complete as possible. usb4java also implements the javax.usb (JSR80) API. So you can choose if you want to access the USB devices via the low-level libusb 1.0 API or via the high level javax.usb API.

The native libraries are included in pre-compiled form for Linux, Windows and Mac OS X in 32 and 64 bit versions. The libraries are automatically extracted and loaded so you don't need to care about them.

For more detailed information please visit the usb4java website.

Build Status