• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNI: MonitorEnter() and Throw()

 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Onion rings are vegetable donuts. Taste this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic