Date: Thu, 1 Jun 2023 21:48:34 -0400
On 6/1/23 20:58, Breno Guimarães wrote:
> I use that pattern all the time. It's useful.
> Worth mentioning it's not fool proof.
> Developers will often search for something in the container, returning
> the iterator.
> Then the iterator outlives the locked scope and things go sour.
Well then either you lock every single object with some wrapper (or
root_ptr or atomic<shared_ptr>):
https://fekir.info/post/sharing-data-between-threads/#_bind-the-data-and-mutex-together
Or you define an undeclared behavior for nested objects going out of scope.
> Em qui., 1 de jun. de 2023 21:54, Phil Bouchard <boost_at_[hidden]
> <mailto:boost_at_[hidden]>> escreveu:
>
>
>
> On 6/1/23 20:50, Breno Guimarães wrote:
> > Ok, it didn't change anything. You still need to think and be
> carefully
> > explicit about the locking scope.
> > I guess folks were just picking on the point that it's impossible
> for
> > the compiler to know the scope. It must be informed by the developer.
> > So everyone is aligned then.
>
> Thanks.
>
> So we would just need to be minimally explicit at the semantic level
> and
> to add "thread and scope recursive" mutices.
>
>
> --
> 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.
>
> I use that pattern all the time. It's useful.
> Worth mentioning it's not fool proof.
> Developers will often search for something in the container, returning
> the iterator.
> Then the iterator outlives the locked scope and things go sour.
Well then either you lock every single object with some wrapper (or
root_ptr or atomic<shared_ptr>):
https://fekir.info/post/sharing-data-between-threads/#_bind-the-data-and-mutex-together
Or you define an undeclared behavior for nested objects going out of scope.
> Em qui., 1 de jun. de 2023 21:54, Phil Bouchard <boost_at_[hidden]
> <mailto:boost_at_[hidden]>> escreveu:
>
>
>
> On 6/1/23 20:50, Breno Guimarães wrote:
> > Ok, it didn't change anything. You still need to think and be
> carefully
> > explicit about the locking scope.
> > I guess folks were just picking on the point that it's impossible
> for
> > the compiler to know the scope. It must be informed by the developer.
> > So everyone is aligned then.
>
> Thanks.
>
> So we would just need to be minimally explicit at the semantic level
> and
> to add "thread and scope recursive" mutices.
>
>
> --
> 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.
>
-- 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 01:48:36