共享信号量类似于 读写锁
boost::shared_mutex shr_mutex;
void write_process() {
shr_mutex.lock();
cout << "begin of write_process" << endl;
cout << "end of write_process" << endl;
shr_mutex.unlock();
}

void read_process() {
shr_mutex.lock_shared();
cout << "begin of read_process" << endl;
cout << "end of read_process" << endl;
shr_mutex.unlock_shared();
}

int main() {
thread_group threads;
for (int i = 0; i < 10; ++ i) {
threads.create_thread(&write_process);
threads.create_thread(&read_process);
}
threads.join_all(); 