1#include "../Mutex.h" 2#include <string> 3 4using std::string; 5 6muduo::MutexLock g_mutex; 7string g_str = "Hello"; 8int32_t g_int32 = 123; 9int64_t g_int64 = 4321; 10 11string getString() 12{ 13 muduo::MutexLockGuard lock(g_mutex); 14 return g_str; 15} 16 17int32_t getInt32() 18{ 19 muduo::MutexLockGuard lock(g_mutex); 20 return g_int32; 21} 22 23int64_t getInt64() 24{ 25 muduo::MutexLockGuard lock(g_mutex); 26 return g_int64; 27} 28 29int main() 30{ 31 getString(); 32 getInt32(); 33 getInt64(); 34} 35