mirror of https://github.com/Icinga/icinga2.git
Add cork
This commit is contained in:
parent
6e7421eab0
commit
419103b407
|
@ -60,7 +60,7 @@ void Stream::SignalDataAvailable(void)
|
|||
}
|
||||
}
|
||||
|
||||
bool Stream::WaitForData()
|
||||
bool Stream::WaitForData(void)
|
||||
{
|
||||
if (!SupportsWaiting())
|
||||
BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting."));
|
||||
|
@ -94,6 +94,16 @@ bool Stream::WaitForData(int timeout)
|
|||
static void StreamDummyCallback(void)
|
||||
{ }
|
||||
|
||||
void Stream::SetCorked(bool corked)
|
||||
{
|
||||
m_Corked = corked;
|
||||
}
|
||||
|
||||
bool Stream::IsCorked(void) const
|
||||
{
|
||||
return m_Corked;
|
||||
}
|
||||
|
||||
void Stream::Close(void)
|
||||
{
|
||||
OnDataAvailable.disconnect_all_slots();
|
||||
|
|
|
@ -131,6 +131,9 @@ public:
|
|||
|
||||
virtual bool SupportsWaiting(void) const;
|
||||
|
||||
virtual void SetCorked(bool corked);
|
||||
bool IsCorked(void) const;
|
||||
|
||||
virtual bool IsDataAvailable(void) const;
|
||||
|
||||
void RegisterDataHandler(const boost::function<void(const Stream::Ptr&)>& handler);
|
||||
|
@ -145,6 +148,8 @@ private:
|
|||
|
||||
boost::mutex m_Mutex;
|
||||
boost::condition_variable m_CV;
|
||||
|
||||
bool m_Corked{false};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue