Re: [Sablevm-developer] Thread.interrupted() solution
Brought to you by:
egagnon
From: Grzegorz B. P. <ga...@de...> - 2004-03-07 06:47:25
|
Hi again, sometimes it's good to put things in writing. I think I should have it solved now. This is how it's supposed to work: I have two flags env->thread.interrupted - the same meaning as Thread.interrupted() env->thread.interrupted_signalled both initially JNI_FALSE interrupt handler simply sets interrupted_signalled = JNI_TRUE; before each C function that can return EINTR which I want to possibly turn into InterruptedException I set interrupted_signalled to JNI_FALSE; If I get EINTR and interrupted_signalled changed state to JNI_TRUE I set interrupted to JNI_TRUE and throw InterrupedException Thread.interrupted() returns interrupted flag and sets it to JNI_FALSE Thread.isInterrupted() returns interrupted flag No locking and atomicity anywhere and so far I can't see any reason for it. ATM I think it pretty much should solve all of the problems I outlined in my other mail, though I might be wrong, as the other implementations I saw were much more complicated. My current version of changes is available using command: svn diff -r 1700:HEAD svn://svn.sablevm.org/developers/gadek/sandbox/svn-interrupt (this branch also contains a cople of other fixes but not many) Cheers, Grzegorz B. Prokopski -- Grzegorz B. Prokopski <ga...@de...> Debian GNU/Linux http://www.debian.org SableVM - LGPLed JVM http://www.sablevm.org Why SableVM ?!? http://devel.sablevm.org/wiki/WhySableVM |