Re: [Sablevm-developer] java.lang.Thread.yield()
Brought to you by:
egagnon
From: Prof. E. M. G. <eti...@uq...> - 2003-02-20 04:03:43
|
On Wed, Feb 19, 2003 at 10:24:44PM -0500, Chris Pickett wrote: > Well it's used all over the place in your code and I thought it would=20 > help me to understand it better. The reason I included it in that=20 > function was because there are many other uses of JNI_OK in=20 > java_lang_Thread.c. OK. > Bruno just answered my question, so it's probably a good idea if I look= =20 > at jni.h a bit. You should read the JNI specification book. It is very well written. It has a first part that explains how to use the JNI interface from a programmer's perspective (giving much insight on the reason why things are setup that way), and the second part is the specification itself. This is where JNI_OK is really defined. The JNI interface has had a very deep impact on the architecture of SableVM. This is why I think you should read the document (in addition to reading the JVM specification, of course). jni.h encodes what is specified in the JNI book. > Okay, sched.h conforms to POSIX.1b, but it's still the GNU C library, so= =20 > if you don't want dependence on sched.h then use pthread_yield(). They= =20 > do the same thing . . . The GNU C library (commonly called glibc or libc6) implements the standard C library + POSIX + other things + GNU extentions. You simply have to restrict yourself to using Standard C + POSIX compatible calls. =2E.. > And so I figured it was a pretty bad thing if the yield() didn't work=20 > because it says pathological, so I thought killing the VM was reasonable. If you look at my solution, you'll note that I suggest that we might simply ignore the return value anyway. This is why your original code semmed OK to me (I was assuming you had already investigated about return values & POSIX compliance). Have fun. Etienne --=20 Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |