C++ Logo

std-proposals

Advanced search

Re: Remove infinite loop UB

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Sat, 9 May 2020 17:38:39 +0300
On 2020-05-09 17:18, connor horman via Std-Proposals wrote:
>
>
> On Sat, May 9, 2020 at 10:14 Andrey Semashev via Std-Proposals
> <std-proposals_at_[hidden] <mailto: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.

I don't think using pure C/C++ for kernel (or bare metal embedded)
development is practical. Primarily because these languages require
certain runtime support and don't implement certain low-level
primitives, like halting the CPU or switching the current execution
context or setting up MMU for memory paging and memory mapped IO or many
other hardware-specific things. That includes setting up hardware
interrupt handlers. These primitives are normally written in assembler.

Received on 2020-05-09 09:41:44