Boost logo

Boost :

Subject: Re: [boost] [thread] scoped_thread' move assignment
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2016-04-17 15:49:44

Le 11/04/2016 13:13, Andrzej Krzemienski a écrit :
> 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.
This is a bug, the callable should be called on the target thread before
doing the move :(
> 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.

Could you show me the code that you used to do that? I suspect that you
need a functor object that do the interrupt and join logic.

> Regards,
> &rzej
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at