Questions tagged [constrained-execution-reg]
4 questions
16
votes
8 answers
Difference between "Critical Section", "Critical Region" and "Constrained Execution Region"
Are these actually three different concepts or am I getting jumbled? (I've been reading articles about threading and garbage collection together and have confused myself.)
"Critical section" - I think this may just be the term for sections of code…

J M
- 1,877
- 2
- 20
- 32
3
votes
1 answer
SafeHandle with memory pressure
The SafeHandle class allows the safe access to native resources under .NET with reference counting and cooperation from the P/Invoke marshaller to avoid premature disposal of handles that could lead to an application crash.
In some situation, it…

Kristóf Marussy
- 1,202
- 8
- 18
1
vote
2 answers
Why PrepareConstrainedRegions method does not work in c#?
I read the book "CLR via C#" by Jeffrey Richter. In chapter 20, there is a code example demonstrating usage of Constrained Execution Regions (CERs):
private static void Demo2() {
// Force the code in the finally to be eagerly prepared
…

helgez
- 157
- 1
- 7
0
votes
1 answer
How to break out a loop contains only a constrained execution region (CER)
I'm using a constrained execution region (CER) to protect the section of code within a while loop of a thread:
private static void MyThreadFunc()
{
try {
...
while (true)
{
…

xiaofeng z
- 93
- 4