ãã¶ã¤ã³ãã¿ã¼ã³ï¼ãã«ãã¹ã¬ããï¼ã¾ã¨ã
- Single Threaded Execution
- Immutable
- Guarded Suspension
- ã¡ã¢
- Balking
- ã¡ã¢
- Producer-Consumer
- ã¡ã¢
- Read-Write Lock
- ã¡ã¢
- Thread-Per-Message
- ã¡ã¢
- Worker Thread
- ã¡ã¢
- Future
- ã¡ã¢
- Two-Phase Termination
- ã¡ã¢
- Thread-Specific Storage
- ã¡ã¢
- Active Object
- ã¡ã¢
ã¡ãªã¿ã«é »ç¹ã«ã¤ã³ã¯ã«ã¼ãããã¦ãã "../thread_helper.h" ã¨ããã®ã¯ä»¥ä¸ã®å
容ã«ãªã£ã¦ãã¾ãã
#ifndef MTDP_THREAD_HELPER_H_INCLUDED #define MTDP_THREAD_HELPER_H_INCLUDED #include <boost/thread.hpp> #include <boost/lexical_cast.hpp> #include <iostream> #include <cstddef> namespace mtdp { struct thread_helper { static void sleep(std::size_t ms) { boost::xtime::xtime_sec_t sec = (boost::xtime::xtime_sec_t)(ms / 1000); boost::xtime::xtime_nsec_t nsec = (boost::xtime::xtime_nsec_t)((ms % 1000) * 1000 * 1000); boost::xtime xt; boost::xtime_get(&xt, boost::TIME_UTC); xt.sec += sec; xt.nsec += nsec; boost::thread::sleep(xt); } template<class T> static void shared_cout(T& value) { static boost::mutex mutex; boost::mutex::scoped_lock lock(mutex); std::cout << value; } }; template<class T> std::string to_string(const T& value) { return boost::lexical_cast<std::string>(value); } } #endif // MTDP_THREAD_HELPER_H_INCLUDED