comparison src/share/vm/runtime/osThread.hpp @ 2386:083f13976b51

6535709: interrupt of wait()ing thread isn't triggerring InterruptedException - test intwait3 Summary: only clear the interrupt state if we will report that it was set Reviewed-by: dcubed, alanb, phh, coleenp, dice
author dholmes
date Mon, 21 Mar 2011 22:16:19 -0400
parents 828eafbd85cc
children f08d439fab8c
comparison
equal deleted inserted replaced
2372:b898f0fc3ced 2386:083f13976b51
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
63 private: 63 private:
64 //void* _start_proc; // Thread start routine 64 //void* _start_proc; // Thread start routine
65 OSThreadStartFunc _start_proc; // Thread start routine 65 OSThreadStartFunc _start_proc; // Thread start routine
66 void* _start_parm; // Thread start routine parameter 66 void* _start_parm; // Thread start routine parameter
67 volatile ThreadState _state; // Thread state *hint* 67 volatile ThreadState _state; // Thread state *hint*
68 jint _interrupted; // Thread.isInterrupted state 68 volatile jint _interrupted; // Thread.isInterrupted state
69 69
70 // Note: _interrupted must be jint, so that Java intrinsics can access it. 70 // Note: _interrupted must be jint, so that Java intrinsics can access it.
71 // The value stored there must be either 0 or 1. It must be possible 71 // The value stored there must be either 0 or 1. It must be possible
72 // for Java to emulate Thread.currentThread().isInterrupted() by performing 72 // for Java to emulate Thread.currentThread().isInterrupted() by performing
73 // the double indirection Thread::current()->_osthread->_interrupted. 73 // the double indirection Thread::current()->_osthread->_interrupted.
87 OSThreadStartFunc start_proc() const { return _start_proc; } 87 OSThreadStartFunc start_proc() const { return _start_proc; }
88 void set_start_proc(OSThreadStartFunc start_proc) { _start_proc = start_proc; } 88 void set_start_proc(OSThreadStartFunc start_proc) { _start_proc = start_proc; }
89 void* start_parm() const { return _start_parm; } 89 void* start_parm() const { return _start_parm; }
90 void set_start_parm(void* start_parm) { _start_parm = start_parm; } 90 void set_start_parm(void* start_parm) { _start_parm = start_parm; }
91 91
92 bool interrupted() const { return _interrupted != 0; } 92 volatile bool interrupted() const { return _interrupted != 0; }
93 void set_interrupted(bool z) { _interrupted = z ? 1 : 0; } 93 void set_interrupted(bool z) { _interrupted = z ? 1 : 0; }
94 94
95 // Printing 95 // Printing
96 void print_on(outputStream* st) const; 96 void print_on(outputStream* st) const;
97 void print() const { print_on(tty); } 97 void print() const { print_on(tty); }