Skip to content

Commit

Permalink
mark all *TaskGroup::ExecuteTask()'s as override
Browse files Browse the repository at this point in the history
1) good practice
2)
	pure virtual method called
	terminate called without an active exception

	Program received signal SIGABRT, Aborted.
	[Switching to Thread 0x7fffe992b700 (LWP 11671)]
	0x00007ffff4c12cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
	56	../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
	(gdb) bt
	#0  0x00007ffff4c12cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
	#1  0x00007ffff4c160d8 in __GI_abort () at abort.c:89
	#2  0x00007ffff551d535 in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
	#3  0x00007ffff551b6d6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
	#4  0x00007ffff551b703 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
	#5  0x00007ffff551c1bf in __cxa_pure_virtual () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
	#6  0x0000000000876ca1 in ThreadPool::DoTask (queue=...) at rts/System/ThreadPool.cpp:150
	#7  0x0000000000876e08 in ThreadPool::WorkerLoop (id=3) at rts/System/ThreadPool.cpp:174
	#8  0x00007ffff556ea60 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
	#9  0x00007ffff78bf182 in start_thread (arg=0x7fffe992b700) at pthread_create.c:312
	#10 0x00007ffff4cd647d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
	(gdb) frame 6
	#6  0x0000000000876ca1 in ThreadPool::DoTask (queue=...) at rts/System/ThreadPool.cpp:150
	150			while (tg->ExecuteTask()) {
	(gdb) p tg
	$1 = (ITaskGroup *) 0x2e806c58
  • Loading branch information
rtri committed Dec 2, 2016
1 parent 6e14f6f commit f56cc55
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rts/System/ThreadPool.h
Expand Up @@ -150,7 +150,7 @@ class SingleTask : public ITaskGroup
this->remainingTasks++;
}

bool ExecuteTask() {
bool ExecuteTask() override {
if (done.exchange(true, std::memory_order_relaxed))
return false;

Expand Down Expand Up @@ -191,7 +191,7 @@ class TTaskGroup : public ITaskGroup
}


bool ExecuteTask()
bool ExecuteTask() override
{
const int pos = curtask.fetch_add(1, std::memory_order_relaxed);
if (pos < tasks.size()) {
Expand Down Expand Up @@ -228,7 +228,7 @@ class TTaskGroup<F,void,Args...> : public ITaskGroup
this->remainingTasks.fetch_add(1, std::memory_order_release);
}

bool ExecuteTask()
bool ExecuteTask() override
{
const int pos = curtask.fetch_add(1, std::memory_order_relaxed);
if (pos < tasks.size()) {
Expand Down Expand Up @@ -259,7 +259,7 @@ class TTaskGroup<F,void> : public ITaskGroup
this->remainingTasks.fetch_add(1, std::memory_order_release);
}

bool ExecuteTask()
bool ExecuteTask() override
{
const int pos = curtask.fetch_add(1, std::memory_order_relaxed);
if (pos < tasks.size()) {
Expand Down Expand Up @@ -293,7 +293,7 @@ class TParallelTaskGroup : public TTaskGroup<F,return_type,Args...>
this->remainingTasks++;
}

bool ExecuteTask()
bool ExecuteTask() override
{
auto& func = uniqueTasks[ThreadPool::GetThreadNum()];
if (!func)
Expand Down Expand Up @@ -347,7 +347,7 @@ class Parallel2TaskGroup : public ITaskGroup
}


bool ExecuteTask()
bool ExecuteTask() override
{
auto& ut = uniqueTasks[ThreadPool::GetThreadNum()];
if (ut) {
Expand Down Expand Up @@ -388,7 +388,7 @@ class ForTaskGroup : public ITaskGroup
}


bool ExecuteTask()
bool ExecuteTask() override
{
const int i = from + (step * curtask.fetch_add(1, std::memory_order_relaxed));
if (i < to) {
Expand Down

0 comments on commit f56cc55

Please sign in to comment.