I have a critical section and 3 procceses,2 of them can be at the same
time in the section.
I use mutex and doing it the followong way below,but it's not working.
How to make it work or maybe to do it in other way ?? Thank you very
much!
Here is the code:
//Function before the critical section:
// Info is singlecall which is mutual to all classes
Start()
{
Guid index=new Guid();
numberofPro =Info.Instance.numberofPro ;
if(numberOfPro >0)
{
Info.Instance.Mutex.ReleaseMute(Info.Instance.know n_index);
}
index=Info.Instance.Mutex.AskMutex();
numberofPro ++;
Info.Instance.numberofPro =numberofPro;
}
End()
{
int numberofPro = Info.Instance.numberofPro ;
numberofPro--;
Guid index=new Guid(Info.Instance.known_index);
if(numberofPro==0)
{
Info.Instance.Mutex.ReleaseMutex(index);
}
Info.Instance.known_index=numberofPro ;
}
//Function in the end of critical section:
*** Sent via Developersdex http://www.developersdex.com ***