C++ Logo

std-proposals

Advanced search

Re: [std-proposals] void std::optional<T>::abandon(void) noexcept

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 29 Nov 2023 20:51:21 +0100
On Wednesday, 29 November 2023 11:28:26 CET Frederick Virchanza Gotham via
Std-Proposals wrote:
> On Tue, Nov 28, 2023 at 8:50 PM Thiago Macieira
>
> > Read: "I have a bug in my software and I want to work around it".
> >
> > You should fix the bug instead. Make your thread properly time out and
> > give the proper notification that it failed, so the future knows so.
>
> I think it's either a device driver, or the operating system, or the
> virtual machine software that's locking up.

Then you have no choice but to reboot. The whole system is unstable at that
point. Trying to work around it is not going to produce good results - the
freezing is going to propagate to more threads.

> But of course the details of my project aren't particularly relevant
> here on this mailing list -- the principle here is that sometimes,
> although rarely, you want to just give up on an object and forget
> about destroying it. For now I think I'll just do:
>
> memset( &obj.value(), 0, sizeof obj.value() ); // not needed
> but paranoia is good
>
> ::new( &obj.value() ) std::future<bool>();
>
> This kind of thing but also be needed for example in embedded systems
> if a bus manager locks up.

The first line isn't necessary.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-11-29 19:51:26