15 #ifndef SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_ 16 #define SAMPLES_SOURCES_MSGPACK_JSONRPC_JSONRPC_H_ 24 #ifndef NLIB_SOCKET_ENABLED 25 #define DONT_USE_SOCKET 31 using nlib_ns::threading::SimpleCriticalSection;
32 using nlib_ns::threading::ScopedLock;
33 ScopedLock<SimpleCriticalSection> l(lock_);
34 BufType::iterator it = buf_.begin();
35 BufType::iterator end = buf_.end();
36 for (; it != end; ++it) {
41 using nlib_ns::threading::SimpleCriticalSection;
42 using nlib_ns::threading::ScopedLock;
43 ScopedLock<SimpleCriticalSection> l(lock_);
44 buf_.push_back(BufItem(data->release(), n));
47 using nlib_ns::threading::SimpleCriticalSection;
48 using nlib_ns::threading::ScopedLock;
49 ScopedLock<SimpleCriticalSection> l(lock_);
50 if (buf_.empty())
return false;
51 BufItem& item = buf_.front();
52 data->reset(item.first);
59 typedef std::pair<uint8_t*, size_t> BufItem;
60 typedef std::list<BufItem> BufType;
61 nlib_ns::threading::SimpleCriticalSection lock_;
70 extern volatile bool g_shutdown_server;
72 #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.