【发布时间】:2017-11-24 19:53:13
【问题描述】:
假设我有一个带有两个 OMP 线程的虚函数的基类:
class Parent {
public:
Parent() {}
~Parent() {}
virtual void f() {
#pragma omp parallel sections
{
#pragma omp section
{
// do_something_1();
}
#pragma omp section
{
// do_something_2();
}
}
}
}
然后我有一个这样的派生类:
class Child : public Parent {
public:
Child() {}
~Child() {}
void f() {
Parent::f();
// Other thread OMD
}
}
我想最后让来自 Parent 类的两个线程和来自 Child 的线程运行,但它不工作。这种设计甚至可能吗?
【问题讨论】:
标签: c++ multithreading openmp