So I have functions like read
that can be called at the same time from multiple threads. but also I have a function to write
that needs to lock all that read
functions. Where to get example of creating such archetecture?
I get that we can have:
mutable boost::mutex the_read_mutex;
mutable boost::mutex the_write_mutex;
and:
void write()
{
// make all new readers wait and wait for all other currently running read threads();
}
void read()
{
// do not make all new readers wait, and wait for all currently running write thread()
}
So how to do such thing?