C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fwd: set_new_handler extension

From: Phil Bouchard <boost_at_[hidden]>
Date: Thu, 1 Jun 2023 20:43:57 -0400
On 6/1/23 20:38, Breno Guimarães wrote:
> This is not as generic as you were proposing.
> The apply function forces the user to chose what is the scope of locking
> for multiple operations. So the compiler doesn't have to magically
> figure out in
> if (container.empty()) container.push();
> It should lock twice or just once. This os given by the user.

Then you create a new member function called container::scope_lock()
which returns my temporary object and you add it to the conditional
statement similar to:
https://github.com/philippeb8/std__ts/blob/master/ts.cpp#L23

But the new corrected code would be:

     if (auto scope_lock = l.scope_lock(); ! l.empty())
     {
         cout << "1) locked = " << boolalpha << l.mutex().locked() << endl;
     }

So the explicitness is very minimal here.

> See also:
> https://github.com/facebook/folly/blob/main/folly/docs/Synchronized.md
> <https://github.com/facebook/folly/blob/main/folly/docs/Synchronized.md>
>
> Em qui., 1 de jun. de 2023 21:05, Phil Bouchard via Std-Proposals
> <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]>>
> escreveu:
>
>
>
> On 6/1/23 12:26, Jason McKesson via Std-Proposals wrote:
>
> > If you want "more positive feedback", you should strive not to
> come to
> > a fact-fight unarmed.
>
> A generic solution is right here and it solves exactly the problem I
> was
> raising:
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p0290r4.html <https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p0290r4.html>
>
> That basically proves again your negative evaluation of everything was
> in vain. Honestly there's a thin line between trolling and your
> comments
> to my regards for some reason.
>
> --
> Logo <https://www.fornux.com/ <https://www.fornux.com/>>
> *Phil Bouchard* facebook icon
> <https://www.linkedin.com/in/phil-bouchard-5723a910/
> <https://www.linkedin.com/in/phil-bouchard-5723a910/>>
> Founder & CEO
> T: (819) 328-4743
> E: phil_at_[hidden] <mailto:phil_at_[hidden]>| www.fornux.com
> <http://www.fornux.com> <http://www.fornux.com <http://www.fornux.com>>
> 8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
>
> Banner <https://goglobalawards.org/ <https://goglobalawards.org/>>
> Le message ci-dessus, ainsi que les
> documents l'accompagnant, sont destinés uniquement aux personnes
> identifiées et peuvent contenir des informations privilégiées,
> confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce
> message par erreur, veuillez le détruire.
> This communication (and/or the attachments) is intended for named
> recipients only and may contain privileged or confidential information
> which is not to be disclosed. If you received this communication by
> mistake please destroy all copies.
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]>
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
> <https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals>
>

-- 
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon
<https://www.linkedin.com/in/phil-bouchard-5723a910/> 
Founder & CEO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les
documents l'accompagnant, sont destinés uniquement aux personnes
identifiées et peuvent contenir des informations privilégiées,
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by
mistake please destroy all copies.

Received on 2023-06-02 00:43:59