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(lock_);
21 BufType::iterator it = buf_.begin();
22 BufType::iterator end = buf_.end();
23 for (; it != end; ++it) {
28 using nlib_ns::threading::SimpleCriticalSection;
29 using nlib_ns::threading::ScopedLock;
30 ScopedLock<SimpleCriticalSection> l(lock_);
31 buf_.push_back(BufItem(data->release(), n));
34 using nlib_ns::threading::SimpleCriticalSection;
35 using nlib_ns::threading::ScopedLock;
36 ScopedLock<SimpleCriticalSection> l(lock_);
37 if (buf_.empty())
return false;
38 BufItem& item = 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 lock_;
57 extern volatile bool g_ShutdownServer;
59 #endif // SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_
Implements mutex, reentrant timeout mutex, and reentrant mutex.
UniquePtr< uint8_t[], ReallocDeleter > UniquePtrType
The typedefed UniquePtr to a uint8_t array.