Boost logo

Boost :

Subject: [boost] [thread] scoped_thread' move assignment
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2016-04-11 07:13:07


Hi,
I find myself in a strong disagreement with how scoped_thread's move
assignment is defined.

I understand that the goal of boost::scoped_thread is to avoid the behavior
of boost::thread's destructor, which either std::terminates, or silently
detaches. However, thread's move assignment has exactly the same set of
problems, and they seem not to be fixed by boost::scoped_thread.
Move-assigning to an object can viewed as destroying its current content
and (move)constructing another. I would intuitively expect the same
CallableThread()(t_)to be called.

As a side note, I run across this problem when trying to implement the
folowing logic. I have a running thread. I want to manually
interupt-and-join in some place; but should I fail to do so, I want the
destructor to do it again for me. I found that impossible to express with
boost::scoped_thread. (Did I miss smething?). I expected that the move
assignment would do the trick, but, lo, it does not.

Regards,
&rzej


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