Critical section equivalent in java
Posted on 2007-12-04
How do you protect a resource in java between threads as in a flag, something like this:
bool SetFlag(bool b)
m_bMyFlag = b;
somebody could be trying to set the flag while another thread is 'getting' it at the same time. How do you make sure only one touches either function at the same time?