Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2006-04-26 22:31:28


Bugs item #1477354, was opened at 2006-04-26 19:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1477354&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: threads
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Mike Glassford (glassfordm)
Summary: object destructor called four times when using thread

Initial Comment:
franzronan_at_[hidden]

I created this test application, I don't know if I
implemented it right but I got four calls on the class
test destructor... current lib version 1.32

#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
#include <iostream>

using namespace std;

class test {
  public:
      test() {
        cout << "constructor" << endl;
      };
     
      ~test() {
        cout << "destructor" << endl;
      };

      void operator()() {
        boost::xtime xt;
        boost::xtime_get(&xt, boost::TIME_UTC);
        xt.sec += 5;
        boost::thread::sleep(xt);
        cout << "sleep" << endl;
      };
};

int main(int argc, char *argv[]) {
  //test scope
  {
    test* a = new test();
    boost::thread* thrd=new boost::thread(*a);
    //got for desctructor calls...
    thrd->join();
  }
}

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1477354&group_id=7586

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk