C++ Logo

std-proposals

Advanced search

Re: [std-proposals] int Func(void) noreentry(-1)

From: Bjorn Reese <breese_at_[hidden]>
Date: Mon, 13 Feb 2023 03:51:35 +0100
On 2/13/23 02:18, Frederick Virchanza Gotham via Std-Proposals wrote:

> thinking. A new idea can be totally new and unique, without any
> precedents, and still be a good idea.

The problem you have described is a classic for event-driven
architectures.

Your solution is return a magic value when busy. Throwing exceptions or
returning std::optional or std::expected would have been more general.
This was explored in P0779.

Others here have suggested a "wait until available" solution using
mutexes.

Another common solution is to enqueue a task for later execution, thus
breaking the recurrence. Networking TS proposes a library solution for
this.

Your proposal should examine the design space and explain why it is
better than the alternatives.

Received on 2023-02-13 02:51:38