C++ Logo

SG12

Advanced search

Subject: Re: [ub] Draft 1 of Stackable, Thread Local, Signal Guards
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2019-05-31 08:49:21


On 31/05/2019 09:07, Peter C++ wrote:
> The code uses something called bitfiel in line 4 and 25. is that just an enum class?

bitfield(name) is a standin for whatever bitfield implementation C2x or
C++ 23 ends up choosing.

> Also, why does the design use virtual functions? If it is about platform differences, this is a compile time issue and not run time.

This is really great feedback, thank you. You caused me to spend a good
15 minutes wondering why this was the case myself, and I wrote the thing.

I believe that you are correct, and they are unnecessary. The reference
implementation was originally a much more complex and powerful solution.
Having built out a lot of complexity for all sorts of use cases, I ended
up purging most of it as it wasn't needed 99% of the time. However I
purged only the topmost API i.e. I ended up with the super simple
signal_guard() API. I didn't refactor raised_signal_info, as it was
debugged and performance tuned.

But I think that you are right, the virtual functions can be removed
entirely, and the implementation simplified. Thank you for spotting it.

Niall


SG12 list run by herb.sutter at gmail.com