2 #ifndef SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_
3 #define SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_
11 #ifndef NLIB_SOCKET_ENABLED
12 #define DONT_USE_SOCKET
18 using nlib_ns::threading::SimpleCriticalSection;
19 using nlib_ns::threading::ScopedLock;
20 ScopedLock<SimpleCriticalSection> l(m_Lock);
21 BufType::iterator it = m_Buf.begin();
22 BufType::iterator end = m_Buf.end();
23 for (; it != end; ++it) {
28 using nlib_ns::threading::SimpleCriticalSection;
29 using nlib_ns::threading::ScopedLock;
30 ScopedLock<SimpleCriticalSection> l(m_Lock);
31 m_Buf.push_back(BufItem(data->release(), n));
34 using nlib_ns::threading::SimpleCriticalSection;
35 using nlib_ns::threading::ScopedLock;
36 ScopedLock<SimpleCriticalSection> l(m_Lock);
37 if (m_Buf.empty())
return false;
38 BufItem& item = m_Buf.front();
39 data->reset(item.first);
46 typedef std::pair<uint8_t*, size_t> BufItem;
47 typedef std::list<BufItem> BufType;
48 nlib_ns::threading::SimpleCriticalSection m_Lock;
57 extern volatile bool g_ShutdownServer;
59 #endif // SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_
ミューテックス, 再入可能ミューテックス, 再入とタイムアウトが可能なミューテックスを実装しています。 ...
UniquePtr< uint8_t[], ReallocDeleter< uint8_t > > UniquePtrType
uint8_tの配列へのUniquePtrをtypedefしたものです。