Re: [Sablevm-developer] java.lang.Thread.yield()
Brought to you by:
egagnon
From: Bruno D. <bru...@ma...> - 2003-02-20 05:26:25
|
On Thursday 20 February 2003 05:01 am, Prof. Etienne M. Gagnon wrote: > On Wed, Feb 19, 2003 at 11:23:31PM -0500, Chris Pickett wrote: > > Okay, I looked at your solution, but apart from the goto end:, it > > doesn't seem different from the fix I suggested a couple of hours ago > > (ignoring the JNI_OK stuff): > >... > > is there really a big difference? or are you mainly talking about the > > comment? > > It seems I have read your code a little too quickly; I thought you > were calling _svmf_abort(or fatal_error?) [this is why I was talking > about aborting]. It's probably because it is late, and because > without the goto end I assumed the call didn't return (which is what > _svmm_fatal_error() does). > > The "goto end" is important for maintenance. Imagine somebody > modifies the code: > > if (sched_yield() != 0) > _svmf_error_InternalError (env); > > yield_done = JNI_TRUE; > > ... > > > This would be wrong, whereas: > > if (sched_yield() != 0) > { > _svmf_error_InternalError (env); > goto end; > } > > yield_done = JNI_TRUE; > > end: > ... > > does the intended thing. > > > P.S. Can you get the JNI book online? I have the JVM spec as part of > > the Java docs, but I take it this is something else. > > Not really. Only the specification part is online (with a few errors, > though), but the user guide part is not. Prof. Hendren should have a > copy of it somewhere. Not quite true. Visit http://java.sun.com/docs/books/jni/index.html It seems like the entire book is there. (or http://java.sun.com/docs/books/index.html in general website for entire series) Bruno > > Etienne |