mirror of
https://github.com/oatpp/oatpp.git
synced 2025-01-06 16:24:27 +08:00
Fix pipe Async action suggestions
This commit is contained in:
parent
ff00d880cf
commit
90cf16181a
@ -124,13 +124,12 @@ public:
|
||||
|
||||
if(prevEntry == nullptr) {
|
||||
popFront();
|
||||
} else if(entry->_ref == nullptr) {
|
||||
prevEntry->_ref = nullptr;
|
||||
last = prevEntry;
|
||||
-- count;
|
||||
} else {
|
||||
prevEntry->_ref = entry->_ref;
|
||||
-- count;
|
||||
if(prevEntry->_ref == nullptr) {
|
||||
last = prevEntry;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ oatpp::async::Action Pipe::Reader::suggestInputStreamAction(data::v_io_size ioRe
|
||||
switch (ioResult) {
|
||||
case oatpp::data::IOError::WAIT_RETRY: {
|
||||
std::unique_lock<std::mutex> lock(m_pipe->m_mutex);
|
||||
if (m_pipe->m_fifo.availableToRead() > 0) {
|
||||
if (m_pipe->m_fifo.availableToRead() > 0 || !m_pipe->m_open) {
|
||||
return oatpp::async::Action::createActionByType(oatpp::async::Action::TYPE_REPEAT);
|
||||
}
|
||||
return oatpp::async::Action::createWaitListAction(&m_waitList);
|
||||
@ -173,7 +173,7 @@ oatpp::async::Action Pipe::Writer::suggestOutputStreamAction(data::v_io_size ioR
|
||||
switch (ioResult) {
|
||||
case oatpp::data::IOError::WAIT_RETRY: {
|
||||
std::unique_lock<std::mutex> lock(m_pipe->m_mutex);
|
||||
if (m_pipe->m_fifo.availableToWrite() > 0) {
|
||||
if (m_pipe->m_fifo.availableToWrite() > 0 || !m_pipe->m_open) {
|
||||
return oatpp::async::Action::createActionByType(oatpp::async::Action::TYPE_REPEAT);
|
||||
}
|
||||
return oatpp::async::Action::createWaitListAction(&m_waitList);
|
||||
@ -204,6 +204,10 @@ std::shared_ptr<Pipe> Pipe::createShared(){
|
||||
return std::make_shared<Pipe>();
|
||||
}
|
||||
|
||||
Pipe::~Pipe() {
|
||||
close();
|
||||
}
|
||||
|
||||
Pipe::Writer* Pipe::getWriter() {
|
||||
return &m_writer;
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public:
|
||||
|
||||
void onNewItem(oatpp::async::CoroutineWaitList& list) override {
|
||||
std::lock_guard<std::mutex> lock(m_pipe->m_mutex);
|
||||
if (m_pipe->m_fifo.availableToWrite() > 0) {
|
||||
if (m_pipe->m_fifo.availableToWrite() > 0 || !m_pipe->m_open) {
|
||||
list.notifyAllAndClear();
|
||||
}
|
||||
}
|
||||
@ -253,6 +253,11 @@ public:
|
||||
*/
|
||||
static std::shared_ptr<Pipe> createShared();
|
||||
|
||||
/**
|
||||
* Virtual destructor.
|
||||
*/
|
||||
virtual ~Pipe();
|
||||
|
||||
/**
|
||||
* Get pointer to &l:Pipe::Writer; for this pipe.
|
||||
* There can be only one &l:Pipe::Writer; per pipe.
|
||||
|
Loading…
Reference in New Issue
Block a user