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

(thread spec) Thread.yield() not clear with respect to monitor ownership

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      Specification of Thread.yield method is pretty brief:

      --------------------------
      public static void yield()

          Causes the currently executing thread object to temporarily pause and allow other threads to execute.
      --------------------------

      And it is not clear how this method behave in respect with monitors ownership.

      BTW, spec explicitly claims that 'sleep' method does not cause thread to lose monitor ownership.
      In this context spec silence about 'Thread.yield' method could be interpreted in following ways:

      1. It is up to implementation to determine if monitor ownership is lost or not.
      2. Monitor ownership is explicitly lost.

      In any case it looks like correct interpretation should be spelled explicitly in spec.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chegar Chris Hegarty
                Reporter:
                sreznick Sergey Reznick (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: