Boostã«ä»¥åããread-writeããã¯ã¯å®è£ ããã¦ããããã§ãããã°ããã£ãã¨ãã§æè¿ã®ç©ã§ã¯upgrade_lock, upgrade_to_unique_lockã«ããå¤ãã£ã¦ãã¾ãã ãã ã®ããã¯ã¨æ¯ã¹ã¦ããã©ã¼ãã³ã¹ãåºãããä¸ã«ç´ æ§ã®è¯ãè¨è¨ã ã¨æãã®ã§ç´¹ä»ãã¦ã¿ããã¨æãã¾ãã read lock read-lockãããå ´åã¯shared_mutexãå¼æ°ã«shared_lockãããã¦ããã°ããã§ãã #include <boost/thread.hpp> using namespace boost; shared_mutex mutex; void reader(){ shared_lock<shared_mutex> read_lock(mutex); // ããã§ããã¯ï¼ // ã¯ãªãã£ã«ã«ã»ã¯ã·ã§ã³ } ã¹ã³ã¼ããå¤ããã¨åæã«shared_lockã®ãã¹ã
{{#tags}}- {{label}}
{{/tags}}