Update to use new this_thread::Poll().

This commit is contained in:
Jari Sundell
2025-05-31 15:22:31 +02:00
committed by GitHub
parent 3618b9dc4f
commit e8c1f3ed2c
6 changed files with 36 additions and 72 deletions
+8 -9
View File
@@ -1,5 +1,7 @@
#include "config.h"
#include "rpc/scgi_task.h"
#include <rak/allocators.h>
#include <rak/error_number.h>
#include <cstdio>
@@ -29,9 +31,9 @@ SCgiTask::open(SCgi* parent, int fd) {
m_position = m_buffer;
m_body = NULL;
torrent::thread_self()->poll()->open(this);
torrent::thread_self()->poll()->insert_read(this);
torrent::thread_self()->poll()->insert_error(this);
torrent::this_thread::poll()->open(this);
torrent::this_thread::poll()->insert_read(this);
torrent::this_thread::poll()->insert_error(this);
}
void
@@ -42,10 +44,7 @@ SCgiTask::close() {
torrent::main_thread()->cancel_callback_and_wait(this);
torrent::thread_self()->cancel_callback(this);
torrent::thread_self()->poll()->remove_read(this);
torrent::thread_self()->poll()->remove_write(this);
torrent::thread_self()->poll()->remove_error(this);
torrent::thread_self()->poll()->close(this);
torrent::this_thread::poll()->remove_and_close(this);
get_fd().close();
get_fd().clear();
@@ -164,7 +163,7 @@ SCgiTask::event_read() {
if ((unsigned int)std::distance(m_buffer, m_position) != m_buffer_size)
return;
torrent::thread_self()->poll()->remove_read(this);
torrent::this_thread::poll()->remove_read(this);
if (m_parent->log_fd() >= 0) {
int __UNUSED result;
@@ -272,7 +271,7 @@ SCgiTask::receive_call(const char* buffer, uint32_t length) {
m_result_mutex.lock();
m_result_mutex.unlock();
torrent::thread_self()->poll()->insert_write(this);
torrent::this_thread::poll()->insert_write(this);
});
};