Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6616502

JNI specification should discuss multiple invocations of DetachCurrentThread

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P3 P3
    • 9
    • 7
    • hotspot
    • x86
    • windows_xp

      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

            dsimms David Simms
            ryeung Roger Yeung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: