Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI: MonitorEnter() and Throw()  RSS feed

 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I wonder if I will have more luck with this post than my last JNI one...

I am getting a failure code (-1) from MonitorEnter(). It doesn't happen every time; most of my calls to MonitorEnter() go fine. But one particular call always seems to go wrong. The call in question happens after I have already called Throw() in the same JNI call.

I am wondering if there is something about calling Throw() that makes MonitorEnter() fail. As far as I can see, the JNI docs say nothing about it, but then they don't say much about Throw() at all!

Anyone know anything about this?
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another one where I found the answer myself. Oh well.

FTR here it is...

The JNI spec (but not the documentation for Throw(), unfortunately) says: -

When there is a pending exception, the only JNI functions that are safe to call are ExceptionOccurred(), ExceptionDescribe(), and ExceptionClear().


So I am not allowed to call MonitorEnter() after Throw(). I will have to rework my code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!