C++ Logo

std-proposals

Advanced search

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

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 14 Feb 2023 16:46:33 +0100
Hi Frederick,   you should compare the typing effort to predefined classes offering this functionality (probably one line for defining the static mutex variable and another one for the lock guard at the usage location) instead of comparing it to the full code. But it is good that you have presented the full code here.   As you saw there are lots of combinations, one could wish for, which more speaks for a feature with (possibly standard) library support than for a language feature. In the future even more combinations could be needed: You assume that all threads are equal, but you could have thread groups, e.g. those running on certain cores, processors, ... the clear industry trend goes to more processor cores (e.g. have a look at https://en.wikipedia.org/wiki/Non-uniform_memory_access#/media/File:Hwloc.png). You got feedback on this list that there are also different solutions how to lock threads with differing performance characteristics.   One could also try to keep the introduced feature totally flexible (and make it even general for other usages), but at the same type reduce the typing effort by either  - Being able to define a static and a non-static variable in one line (somehow as class) or  - Metaprogramming/Metaclasses approaches, where classes and functions can be expanded and changed by compile-time code according to parameters/annotations   Best, Sebastian   -----Ursprüngliche Nachricht----- Von:Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 14.02.2023 11:52 Betreff:Re: [std-proposals] int Func(void) noreentry(-1) An:std-proposals_at_[hidden]; CC:Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>; On Tue, Feb 14, 2023 at 9:32 AM Frederick Virchanza Gotham wrote: I want to show just how much typing this would save. The following code snippet:  

Received on 2023-02-14 15:46:35