C++ Logo

std-proposals

Advanced search

Re: Remove infinite loop UB

From: connor horman <chorman64_at_[hidden]>
Date: Sat, 9 May 2020 10:18:09 -0400
On Sat, May 9, 2020 at 10:14 Andrey Semashev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> There is sigwait for this kind of use cases. Or any other kind of
> blocking - sleep, select, condition_variable::wait, etc.
>
> Busy waiting as a means of blocking the thread for extended periods of
> time is not something that should be encouraged, IMHO.

Ah yes, that works quite well in embedded/freestanding (or os dev,
especially) where I don't have:
a) posix
b) <thread>
c) <mutex>
d) Stuff along those lines.

>
>
> On 2020-05-09 16:18, Tony V E via Std-Proposals wrote:
> > The basic idea is a program that looks like:
> >
> > int main()
> > {
> > setupSignalHandlers();
> > for(;;)
> > ;
> > }
> >
> > The real work of the program happens in the signal handlers.
> > Or interrupts. Etc.
> >
> > Nothing happens on the main thread. But it needs to be running for the
> > signal handlers to have somewhere to run.
> >
> > We could have a special function for this:
> >
> > for (;;)
> > std::magic_pretend_im_doing_something();
> >
> > Not sure how we specify it though.
> >
> >
> > Sent from my BlackBerry portable Babbage Device
> > *From: *Dmitry via Std-Proposals
> > *Sent: *Saturday, May 9, 2020 8:53 AM
> > *To: *sotrdg sotrdg via Std-Proposals
> > *Reply To: *std-proposals_at_[hidden]
> > *Cc: *Dmitry
> > *Subject: *Re: [std-proposals] Remove infinite loop UB
> >
> >
> > Can you please explain this in more detail?
> >
> > > SNES Game that's *_finished_* but *_needs still draw/redraw_* stuff
> >
> >
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-05-09 09:21:22