add Thread::interrupt

This commit is contained in:
David Rose 2004-01-23 00:14:47 +00:00
parent 33614fa4ce
commit 13d1f95326
6 changed files with 38 additions and 0 deletions

View File

@ -95,6 +95,20 @@ start(ThreadPriority priority, bool global, bool joinable) {
return _started;
}
////////////////////////////////////////////////////////////////////
// Function: Thread::interrupt
// Access: Public
// Description: Sends an interrupt message to the thread. This will
// interrupt any blocking-type system calls the thread
// may be waiting on, such as I/O, so that the thread
// may continue some other processing. The specific
// behavior is implementation dependent.
////////////////////////////////////////////////////////////////////
INLINE void Thread::
interrupt() {
_impl.interrupt();
}
////////////////////////////////////////////////////////////////////
// Function: Thread::join
// Access: Public

View File

@ -53,6 +53,7 @@ public:
INLINE const string &get_name() const;
INLINE bool start(ThreadPriority priority, bool global, bool joinable);
INLINE void interrupt();
INLINE void join();
INLINE static void prepare_for_exit();

View File

@ -45,6 +45,15 @@ start(ThreadPriority, bool, bool) {
return false;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadDummyImpl::interrupt
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
INLINE void ThreadDummyImpl::
interrupt() {
}
////////////////////////////////////////////////////////////////////
// Function: ThreadDummyImpl::join
// Access: Public

View File

@ -48,6 +48,7 @@ public:
INLINE ~ThreadDummyImpl();
INLINE bool start(ThreadPriority priority, bool global, bool joinable);
INLINE void interrupt();
INLINE void join();
INLINE static void prepare_for_exit();

View File

@ -155,6 +155,18 @@ start(ThreadPriority priority, bool global, bool joinable) {
return true;
}
////////////////////////////////////////////////////////////////////
// Function: ThreadNsprImpl::interrupt
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void ThreadNsprImpl::
interrupt() {
if (_thread != (PRThread *)NULL) {
PR_Interrupt(_thread);
}
}
////////////////////////////////////////////////////////////////////
// Function: ThreadNsprImpl::join
// Access: Public

View File

@ -43,6 +43,7 @@ public:
INLINE ~ThreadNsprImpl();
bool start(ThreadPriority priority, bool global, bool joinable);
void interrupt();
void join();
INLINE static void prepare_for_exit();