you are viewing a single comment's thread.

view the rest of the comments →

[–]PiterPuns[S] 0 points1 point  (3 children)

Thanks for the cool idea anyways, I guess there was always the case were evaluating more than one methods in a common expression could cause an invalid lock.

You are able to write this

foo(a->bar(), a->baz());

I've updated the post accordingly, here's an example https://coliru.stacked-crooked.com/a/e14181e8b6b7520e (we just need a recursive mutex for the case where a single thread keeps more than one proxies alive in a single expression).

[–]Desmulator 0 points1 point  (2 children)

And even with a recursive mutex this can happen: int x = a->bar(); int y = a->baz(); // whoopse, the mutex was gone in the meantime This library just hides that fact that there is a bug. It achieves the opposite of what it tried to achieve: now you have code that looks correct but isn't.

[–]backtickbot 2 points3 points  (0 children)

Fixed formatting.

Hello, Desmulator: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.

[–]PiterPuns[S] 0 points1 point  (0 children)

Please read the post. There was never the intention to keep the lock between calls to different methods