C++ Logo

std-proposals

Advanced search

Re: Remove infinite loop UB

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sat, 9 May 2020 17:14:23 +0300
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.

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
>
>

Received on 2020-05-09 09:17:28