I'm trying to implement the following code in C (not C++) with threads and CS.
For some reason, it seems it does not affect the threads and they all enter the CS.
The app is Win32 based using MS-Visual.
I know this implementation might cause starvation, but i don't care at the moment.. ;)
// the paseudo code:
static int cs = 0;
// run some threads...
if (cs == 1)
cs = 1;
// do CS here..
cs = 0;