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()
}