Boost logo

Boost Users :

From: Ken Klose (ken.klose_at_[hidden])
Date: 2007-04-27 13:15:27


I've got a singleton object that is trying to run its operator() method in a
separate thread, but I'm getting a segfault when I construct the thread
object:

PublishedListener::PublishedListener(string directory)
{
    _thread = new thread(*this); // segfault here
}

PublishedListener.h:
class PublishedListener
{
public:
    static PublishedListener &getInstance();
    void run();
    void operator()();
    boost::filesystem::path getItemDirectory();
    virtual ~PublishedListener();
private:
    PublishedListener(std::string directory);
    static PublishedListener *_instance;
    boost::thread *_thread;
    boost::filesystem::path *itemDirectory;
};

Thanks in advance!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net