8 Replies Latest reply: Jun 28, 2011 7:29 PM by EJP RSS

    monitor_contended_enter and monitor_contended_entered with JNIEvn calls

    862500
      I have tried to work out monitor_contended_enter and monitor_contended_entered by injecting the wait() and notify() java methods. The idea is when monitor_contended_enter happens, the previously held monitor will invoke wait(). So that the monitor released and the other threads can get it. Once the other threads "get it", which is ideally the monitor_contended_entered triggered, I use JNIEnv to notifyAll() on the waiting objects, which include the one I just called wait() previously. The wait() is perfectly fine, even with notifyAll in the java class. But the problem is when a JNIEnv call notifyAll(), a "A fatal error has been detected by the Java Runtime Environment" will occur. I imagine the "entered" event happens too soon, so the JVM has not maintain the wait state under its mechanism. Any helps can share with me will be great! Thanks in advance.

      Marinek