How to set a reader-writer lock for a specific segment of code?

35 views Asked by At

I need to lock a specific section of my code and the problem is as follows:

I must allow multiple read threads and single write thread to the section something like:

get readlock()
{
if(s==1)
  get writelock()

or else 
   continue with read lock()
}
0

There are 0 answers