exposing receiver thread ids to client (#102)

* exposing receiver thread ids to client

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
Dhanya Thattil
2020-06-09 16:18:37 +02:00
committed by GitHub
parent 2a2bb5f63a
commit f5160b0978
48 changed files with 1151 additions and 580 deletions

View File

@ -28,6 +28,8 @@ ThreadObject::~ThreadObject() {
sem_destroy(&semaphore);
}
pid_t ThreadObject::GetThreadId() const { return threadId; }
bool ThreadObject::IsRunning() const { return runningFlag; }
void ThreadObject::StartRunning() { runningFlag = true; }
@ -35,8 +37,9 @@ void ThreadObject::StartRunning() { runningFlag = true; }
void ThreadObject::StopRunning() { runningFlag = false; }
void ThreadObject::RunningThread() {
threadId = syscall(SYS_gettid);
LOG(logINFOBLUE) << "Created [ " << type << "Thread " << index
<< ", Tid: " << syscall(SYS_gettid) << "]";
<< ", Tid: " << threadId << "]";
while (!killThread) {
while (IsRunning()) {
ThreadExecution();
@ -45,7 +48,8 @@ void ThreadObject::RunningThread() {
sem_wait(&semaphore);
}
LOG(logINFOBLUE) << "Exiting [ " << type << " Thread " << index
<< ", Tid: " << syscall(SYS_gettid) << "]";
<< ", Tid: " << threadId << "]";
threadId = 0;
}
void ThreadObject::Continue() { sem_post(&semaphore); }