Re: [Boost-users] [thread] Segfault constructing a thread

28 Apr
2007
28 Apr
'07
3:27 p.m.
Peter, Thank you very much. Your suggestions have fixed it. Ken "Peter Dimov" <pdimov@mmltd.net> wrote in message news:<008b01c789b2$21b0fe20$6607a8c0@pdimov2>...
Ken Klose wrote:
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 }
This line makes a copy of *this. It's very likely that this isn't what you want. Use ref(*this) to store a reference, and consider disabling the copy constructor and the assignment operator of the class.
6627
Age (days ago)
6627
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ken Klose