11bc80516SShuo Chen#include "../Mutex.h" 21bc80516SShuo Chen#include <string> 31bc80516SShuo Chen 41bc80516SShuo Chenusing std::string; 51bc80516SShuo Chen 61bc80516SShuo Chenmuduo::MutexLock g_mutex; 71bc80516SShuo Chenstring g_str = "Hello"; 81bc80516SShuo Chenint32_t g_int32 = 123; 91bc80516SShuo Chenint64_t g_int64 = 4321; 101bc80516SShuo Chen 111bc80516SShuo Chenstring getString() 121bc80516SShuo Chen{ 131bc80516SShuo Chen muduo::MutexLockGuard lock(g_mutex); 141bc80516SShuo Chen return g_str; 151bc80516SShuo Chen} 161bc80516SShuo Chen 171bc80516SShuo Chenint32_t getInt32() 181bc80516SShuo Chen{ 191bc80516SShuo Chen muduo::MutexLockGuard lock(g_mutex); 201bc80516SShuo Chen return g_int32; 211bc80516SShuo Chen} 221bc80516SShuo Chen 231bc80516SShuo Chenint64_t getInt64() 241bc80516SShuo Chen{ 251bc80516SShuo Chen muduo::MutexLockGuard lock(g_mutex); 261bc80516SShuo Chen return g_int64; 271bc80516SShuo Chen} 281bc80516SShuo Chen 291bc80516SShuo Chenint main() 301bc80516SShuo Chen{ 311bc80516SShuo Chen getString(); 321bc80516SShuo Chen getInt32(); 331bc80516SShuo Chen getInt64(); 341bc80516SShuo Chen} 35