Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:twall/jna

  • Loading branch information...
commit c1a7fd72675a6bf18c1d84078c1bdd2005dcc3c6 2 parents 3c086de + b48390f
@twall authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 test/com/sun/jna/CallbacksTest.java
View
12 test/com/sun/jna/CallbacksTest.java
@@ -1036,13 +1036,16 @@ public void callback() {
1, threads.size());
}
+ // Thread object is never GC'd on linux-amd64 and (sometimes) win32-amd64
public void testAttachedThreadCleanupOnExit() throws Exception {
final Set threads = new HashSet();
final int[] called = { 0 };
TestLibrary.VoidCallback cb = new TestLibrary.VoidCallback() {
public void callback() {
threads.add(new WeakReference(Thread.currentThread()));
- ++called[0];
+ if (++called[0] == 1) {
+ Thread.currentThread().setName("Thread to be cleaned up");
+ }
Native.detach(false);
}
};
@@ -1056,11 +1059,10 @@ public void callback() {
while (ref.get() != null) {
System.gc();
Thread.sleep(10);
- if (System.currentTimeMillis() - start > 5000) {
- fail("Timed out waiting for attached thread to be detached on exit and disposed: " + ref.get());
+ if (System.currentTimeMillis() - start > 10000) {
+ Thread t = (Thread)ref.get();
+ fail("Timed out waiting for attached thread to be detached on exit and disposed: " + t + " alive: " + t.isAlive() + " daemon " + t.isDaemon());
}
- // Try calling into native to spur thread cleanup
- lib.callVoidCallback(cb);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.