Critical section


Wish to know what happens if wait and signal calls are swapped.

1
2
3
wait(mutex);
...Critical Section
signal(mutex);


thanks experts!
Last edited on
Talking from a Windows perspective, that's the normal way, kindof.

In Windows, you "wait" on the sync object (is a wait for an event or semaphore, but is a special function for critical section objects) first, then access the critical section, then abandon the sync object (special function for a critical section object, other functions for other types of sync objects).

So I'm not really sure if you are posing this question correctly. Maybe it is backwards?

In any case, I don't see a point worth the time here. If you enter a critical section without waiting, you most likely corrupt the underlying data. Is that your answer?
Topic archived. No new replies allowed.