mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
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())
|
if (!SupportsWaiting())
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting."));
|
BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support waiting."));
|
||||||
@ -94,6 +94,16 @@ bool Stream::WaitForData(int timeout)
|
|||||||
static void StreamDummyCallback(void)
|
static void StreamDummyCallback(void)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
void Stream::SetCorked(bool corked)
|
||||||
|
{
|
||||||
|
m_Corked = corked;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Stream::IsCorked(void) const
|
||||||
|
{
|
||||||
|
return m_Corked;
|
||||||
|
}
|
||||||
|
|
||||||
void Stream::Close(void)
|
void Stream::Close(void)
|
||||||
{
|
{
|
||||||
OnDataAvailable.disconnect_all_slots();
|
OnDataAvailable.disconnect_all_slots();
|
||||||
|
@ -131,6 +131,9 @@ public:
|
|||||||
|
|
||||||
virtual bool SupportsWaiting(void) const;
|
virtual bool SupportsWaiting(void) const;
|
||||||
|
|
||||||
|
virtual void SetCorked(bool corked);
|
||||||
|
bool IsCorked(void) const;
|
||||||
|
|
||||||
virtual bool IsDataAvailable(void) const;
|
virtual bool IsDataAvailable(void) const;
|
||||||
|
|
||||||
void RegisterDataHandler(const boost::function<void(const Stream::Ptr&)>& handler);
|
void RegisterDataHandler(const boost::function<void(const Stream::Ptr&)>& handler);
|
||||||
@ -145,6 +148,8 @@ private:
|
|||||||
|
|
||||||
boost::mutex m_Mutex;
|
boost::mutex m_Mutex;
|
||||||
boost::condition_variable m_CV;
|
boost::condition_variable m_CV;
|
||||||
|
|
||||||
|
bool m_Corked{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user