-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes in thread interrupts mechanism.
1. On Linux when pthread_cond_wait or pthread_cond_timedwait are called, when a signal is deilivered the thread resumes waiting for the condition variable as if it was not interrupted. To fix this problem a thread is unparked before sending interrupt to it. 2. When Unsafe.park(boolean isAbsolute, long time) is interrupted on return from this function Thread.isInterrupted() should return true, however this doesn't happen as, interrupt flag is cleared in StandardJavaMonitor.monitorWait(long timeoutMilliSeconds). To fix this problem an interrupt flag is set to true on catching InterruptedException exception in Unsafe.park(boolean isAbsolute, long time). 3. When thread is being transitioned to not alive state and recieves interrupt signal, it cannot handle it as it is in inconsistent half alive state. To fix this problem interrupt signals are blocked for threads being transitioned to not alive state. 4. Between Thread.interrupt() call and sending an interrupt signal to a thread, it can be detached. This case is treated as na error. To fix it, when a function sending a signal returns ESRCH, it is not treated as an error.
- Loading branch information
Showing
5 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters