⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lock.h

📁 This software was done in part for a textbook on AI I ve written called _The Basis of AI_ (tentative
💻 H
字号:
class rw_lock{public:  rw_lock() : number(0) {} ~rw_lock() {};  void acquire_write();  void writer_enter();  void acquire_read();  void reader_enter();  void release_write();  void writer_exit();  void release_read();  void reader_exit();/*int tryenter();*/private:  leda_mutex lock1, lock2, helplock;  int number;     };class read_guard {public:  read_guard (rw_lock& l) : rw_lock_(l) { rw_lock_.acquire_read(); } ~read_guard() { rw_lock_.release_read(); }private:  rw_lock& rw_lock_;};         class write_guard {public:  write_guard (rw_lock& l) : rw_lock_(l) { rw_lock_.acquire_write(); } ~write_guard() { rw_lock_.release_write(); }private:  rw_lock& rw_lock_;}; 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -