[Autogenerated] Here,
is an example of the C++ ri ID to mimic the functionality of the tri finally,
which doesn't exist in C++ So going back,
to the example, we've seen with the critical section.
Let's suppose we need to call an critical section,
fi critical section, and make sure that that happens no matter what.
So here's one way of doing that we can create a wrapper class called
here auto CSS that has in its party a reference,
to a critical section which we accept in the constructor,
and also, call an critical section, to acquire the critical section.
Then We have a Destructor, that's going to call leaf critical section,
to let the critical section, go in the sense,
allowing other threads, to require the critical section.
Now, this can work on any critical section here.
Is an example where I have a global critical section here,
and then I'm going to acquire that critical section by
creating a local variable of type auto,
two cs and Once we do that the constructor will acquire the critical section.
When this variable goes out of scope,
the critical section will be released which is exactly what we want.
So even if you call return here within the function F
it doesn't matter the Destructor,
going to be called first call leave critical section as we expect.