8 Replies Latest reply on Jun 29, 2011 12:29 AM by EJP

    monitor_contended_enter and monitor_contended_entered with JNIEvn calls

      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.