944,070 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2472
  • C++ RSS
Oct 12th, 2006
0

multithreading & destructor call.

Expand Post »
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
Similar Threads
Reputation Points: 20
Solved Threads: 0
Junior Poster in Training
kararu is offline Offline
50 posts
since Sep 2006
Oct 12th, 2006
0

Re: multithreading & destructor call.

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Max size of Array
Next Thread in C++ Forum Timeline: GetTickCount Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC