| | |
multithreading & destructor call.
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2006
Posts: 50
Reputation:
Solved Threads: 0
Hi,
I am doin a multithreading program in c++.
......
class thr
{......
public:
d =new char[35];
......
void start(){...start thread by calling function run..}
void run(){...}
int joining(){..join all threads}
~thr(){delete []d;}
};
In the program I am creating all threads,calling start on all thread objects and then calling joining on all thread objects.
Now I want to know when will this destructor be called for each thread object?Finally altogether or when each thread joins..or....
confused state :-|....help me out,pls.
thanks
I am doin a multithreading program in c++.
......
class thr
{......
public:
d =new char[35];
......
void start(){...start thread by calling function run..}
void run(){...}
int joining(){..join all threads}
~thr(){delete []d;}
};
In the program I am creating all threads,calling start on all thread objects and then calling joining on all thread objects.
Now I want to know when will this destructor be called for each thread object?Finally altogether or when each thread joins..or....
confused state :-|....help me out,pls.
thanks
I've just explained how to do threads with classes here
http://forums.devshed.com/c-programm...ss-393019.html
To be honest, tackling threads before you've got the rest of C++ well sorted out in your head is a receipe for disaster.
http://forums.devshed.com/c-programm...ss-393019.html
To be honest, tackling threads before you've got the rest of C++ well sorted out in your head is a receipe for disaster.
![]() |
Similar Threads
- C++ Performance Tips (C++)
- (C++) Writing a Copy Constructor?!? (C++)
- ofstream (C)
- C++ BASICS ==> Pointers, Call by Reference/Value, Inheritance, Functions & Arrays (C++)
- Multithreading problem (C)
Other Threads in the C++ Forum
- Previous Thread: differentiation
- Next Thread: GetTickCount Problem
Views: 1704 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort sorting spoonfeeding string strings struct temperature template templates text tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






