- auto on_startup_failure = on_unwind(
- [this]
- {
- if (started_future.wait_for(0s) != std::future_status::ready)
- started.set_exception(std::current_exception());
- });
-
...
catch(...)
{
+ try
+ {
+ //Move the promise so that the promise destructor occurs here rather than in the thread
+ //destroying CompositingFunctor, mostly to appease TSan
+ auto promise = std::move(started);
+ promise.set_exception(std::current_exception());
+ }
+ catch(...)
+ {
+ }
So we no longer use "on_unwind()" because the destructor of the moved promise will throw after we set_exception()? And then we eat the exception anyway? That seems an overly complex mechanism to destroy CompositingFunctor::promise.
I'd really like to approve a lot of these changes as they are obviously correct.
But the rework of CompositingFunc tor::operator( ) isn't...
~~~~
+ //Appease TSan, avoid destructor and this thread accessing the same shared_ptr instance display_ listener) ;
+ auto disp_listener = std::move(
As display_listener is const, isn't this simpler as:
auto const disp_listener = display_listener;
Or even better, just make it a value capture in the lines below? Vis:
auto display_ registration = mir::raii: :paired_ calls(
[display_ listener= display_ listener, &group= group]{ group.for_ each_display_ buffer( [&](mg: :DisplayBuffer& buffer) listener- >add_display( buffer. view_area( )); });},
[display_ listener= display_ listener, &group= group]{ group.for_ each_display_ buffer( [&](mg: :DisplayBuffer& buffer) listener- >remove_ display( buffer. view_area( )); });});
{ display_
{ display_
~~~~
- auto on_startup_failure = on_unwind( future. wait_for( 0s) != std::future_ status: :ready) set_exception( std::current_ exception( )); set_exception( std::current_ exception( ));
- [this]
- {
- if (started_
- started.
- });
-
...
catch(...)
{
+ try
+ {
+ //Move the promise so that the promise destructor occurs here rather than in the thread
+ //destroying CompositingFunctor, mostly to appease TSan
+ auto promise = std::move(started);
+ promise.
+ }
+ catch(...)
+ {
+ }
So we no longer use "on_unwind()" because the destructor of the moved promise will throw after we set_exception()? And then we eat the exception anyway? That seems an overly complex mechanism to destroy CompositingFunc tor::promise.