由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - multithread and c++ destructor
相关主题
请教一个基本的constructor和destrcutor问题how to destruct list with loop?
构造函数里的异常处理请教c++ multithreading入门问题
子类的destructor被调用时,什么时候调用基类的destructorRe: can destructor be static?
请教个Bloomberg 的 C++ 题目关于内存泄漏
[C++] when destructors get calledHelp! Virtual Destructor
【C++】请问这样有没有memory leak?多谢A try-catch problem in C++
Windows XP与Multithreading Programming有人export class from a dll 吗?
Pthread support on Windows XPsome C++ interview questions
相关话题的讨论汇总
话题: run话题: thread话题: destructor话题: let
进入Programming版参与讨论
1 (共1页)
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;
: }

1 (共1页)
进入Programming版参与讨论
相关主题
some C++ interview questions[C++] when destructors get called
[菜鸟问题]类模板问题【C++】请问这样有没有memory leak?多谢
几个问题Windows XP与Multithreading Programming
问两个问题,C++Pthread support on Windows XP
请教一个基本的constructor和destrcutor问题how to destruct list with loop?
构造函数里的异常处理请教c++ multithreading入门问题
子类的destructor被调用时,什么时候调用基类的destructorRe: can destructor be static?
请教个Bloomberg 的 C++ 题目关于内存泄漏
相关话题的讨论汇总
话题: run话题: thread话题: destructor话题: let