s*****e 发帖数: 33 | 1 Have this question, let's say I have two objects:
class A
{
~A();
void run();
}
class B
{
A a;
}
B b;
Let's say A::run() is the running function of a thread; and b is created and
running in another thread, in this same thread, we spawn another thread and
run A::run();
when program exit, ideally B should wait (or join) a::run(), let's suppose B
does not wait, so B is destructed but A::run() is still running, my
question is whether A::~A() will get called when B is destructed (even A::
run() | X****r 发帖数: 3557 | 2 Yes.
【在 s*****e 的大作中提到】 : Have this question, let's say I have two objects: : class A : { : ~A(); : void run(); : } : class B : { : A a; : }
|
|