Boost logo

Boost :

Subject: Re: [boost] asio::ip::tcp::socket and boost::thread
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-01-06 10:33:32


xutm wrote:

> class transStream {
> public:
> transStream() {
> cb = NULL;
> thrd = NULL;
> }
> ~transStream() {
> if (sock) {

The value of sock is undefined here, which might explain some problems
you're having.

> sock->close; // would be segment fault

Did you mean sock->close()?

> if (thrd) {
> cout << "ready to delete the thread ..." << endl;
> //delete thrd;
> thrd->interrupt(); // actually, the thread still exists and
> runs

That's normal. You can't just stop threads, you can only request that it
stops.
The thread will be stopped when the next interruption point is reached.
See the documentation about what interruption points are.


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