JDK-6616502 : JNI specification should discuss multiple invocations of DetachCurrentThread
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-10-12
  • Updated: 2015-06-02
  • Resolved: 2015-06-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
A DESCRIPTION OF THE REQUEST :
The JNI speciifcation should explicitly discuss what happens if a user invokes DetachCurrentThread() on a thread that is already detached (or has never been attached). I have seen at least one implementation that would crash when this happens.

The specification should also discuss what happens if the user invokes:

attach, attach
detach, detach

Is the thread still attached before the 2nd detach() call? That is, is there a reference count and the thread is only attached when the count drops to zero? Or is the thread detached the first time detach() is called regardless of how many times attach() was called?

Again, I have seen an implementation in that differs from Sun's and it led to problems.

JUSTIFICATION :
Improve JNI code portability by clarifying this hole in the specification

Comments
Merged into 8079466
02-06-2015

Reviewed: http://cr.openjdk.java.net/~dsimms/jnispec/6616502/ Assigned to tech writer: JDK-8042218
15-05-2014