osThread_windows.hpp revision 0:a61af66fc99e
1234353Sdim/* 2193323Sed * Copyright 1997-2001 Sun Microsystems, Inc. All Rights Reserved. 3193323Sed * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4193323Sed * 5193323Sed * This code is free software; you can redistribute it and/or modify it 6193323Sed * under the terms of the GNU General Public License version 2 only, as 7193323Sed * published by the Free Software Foundation. 8193323Sed * 9193323Sed * This code is distributed in the hope that it will be useful, but WITHOUT 10193323Sed * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11193323Sed * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12193323Sed * version 2 for more details (a copy is included in the LICENSE file that 13193323Sed * accompanied this code). 14193323Sed * 15193323Sed * You should have received a copy of the GNU General Public License version 16193323Sed * 2 along with this work; if not, write to the Free Software Foundation, 17249423Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18193323Sed * 19249423Sdim * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20249423Sdim * CA 95054 USA or visit www.sun.com if you need additional information or 21198090Srdivacky * have any questions. 22193323Sed * 23193323Sed */ 24193323Sed 25193323Sedtypedef void* HANDLE; 26204642Srdivacky 27193323Sed private: 28193323Sed // Win32-specific thread information 29193323Sed HANDLE _thread_handle; // Win32 thread handle 30249423Sdim unsigned long _thread_id; // Win32 thread id 31249423Sdim HANDLE _interrupt_event; // Event signalled on thread interrupt 32249423Sdim ThreadState _last_state; 33249423Sdim 34249423Sdim public: 35249423Sdim // The following will only apply in the Win32 implementation, and should only 36193323Sed // be visible in the concrete class, not this which should be an abstract base class 37198090Srdivacky HANDLE thread_handle() const { return _thread_handle; } 38198090Srdivacky void set_thread_handle(HANDLE handle) { _thread_handle = handle; } 39251662Sdim HANDLE interrupt_event() const { return _interrupt_event; } 40251662Sdim void set_interrupt_event(HANDLE interrupt_event) { _interrupt_event = interrupt_event; } 41193323Sed 42193323Sed unsigned long thread_id() const { return _thread_id; } 43193323Sed#ifndef PRODUCT 44219077Sdim // Used for debugging, return a unique integer for each thread. 45193323Sed int thread_identifier() const { return _thread_id; } 46219077Sdim#endif 47193323Sed#ifdef ASSERT 48193323Sed // We expect no reposition failures so kill vm if we get one 49193323Sed // 50193323Sed bool valid_reposition_failure() { 51193323Sed return false; 52193323Sed } 53193323Sed#endif // ASSERT 54198090Srdivacky void set_thread_id(unsigned long thread_id) { _thread_id = thread_id; } 55198090Srdivacky 56204961Srdivacky bool is_try_mutex_enter() { return false; } 57204961Srdivacky 58204961Srdivacky // This is a temporary fix for the thread states during 59249423Sdim // suspend/resume until we throw away OSThread completely. 60204642Srdivacky // NEEDS_CLEANUP 61204642Srdivacky void set_last_state(ThreadState state) { _last_state = state; } 62263508Sdim ThreadState get_last_state() { return _last_state; } 63204961Srdivacky 64193323Sed private: 65193323Sed void pd_initialize(); 66193323Sed void pd_destroy(); 67193323Sed