aboutsummaryrefslogtreecommitdiff
path: root/src/jthread/pthread
diff options
context:
space:
mode:
Diffstat (limited to 'src/jthread/pthread')
-rw-r--r--src/jthread/pthread/jthread.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/jthread/pthread/jthread.cpp b/src/jthread/pthread/jthread.cpp
index 2980e26b1..c4d9162c8 100644
--- a/src/jthread/pthread/jthread.cpp
+++ b/src/jthread/pthread/jthread.cpp
@@ -34,6 +34,7 @@ JThread::JThread()
{
retval = NULL;
mutexinit = false;
+ requeststop = false;
running = false;
}
@@ -44,7 +45,7 @@ JThread::~JThread()
void JThread::Stop() {
runningmutex.Lock();
- running = false;
+ requeststop = true;
runningmutex.Unlock();
}
@@ -78,6 +79,7 @@ int JThread::Start()
runningmutex.Unlock();
return ERR_JTHREAD_ALREADYRUNNING;
}
+ requeststop = false;
runningmutex.Unlock();
pthread_attr_t attr;
@@ -141,6 +143,15 @@ bool JThread::IsRunning()
return r;
}
+bool JThread::StopRequested() {
+ bool r;
+
+ runningmutex.Lock();
+ r = requeststop;
+ runningmutex.Unlock();
+ return r;
+}
+
void *JThread::GetReturnValue()
{
void *val;