diff --git a/emper/AsyncLibrary.cpp b/emper/AsyncLibrary.cpp index c4c1b6b8f791b4125dc532ab8027f0129e84cf6c..8ca9027d1a77b1bc1871491c6c05d42ff3501736 100644 --- a/emper/AsyncLibrary.cpp +++ b/emper/AsyncLibrary.cpp @@ -209,7 +209,7 @@ static bool do_async_send(int fd, unsigned char* buff, int buff_len, int* return return false; } -int async_connect(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serialized) +int io::async_connect(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serialized) { int flags = fcntl(fd, F_GETFL, 0); @@ -266,7 +266,7 @@ int async_connect(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serializ return 0; } -int async_accept(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serialized) +int io::async_accept(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serialized) { int flags = fcntl(fd, F_GETFL, 0); @@ -318,7 +318,7 @@ int async_accept(int fd, sockaddr* sockaddress, socklen_t len, bool fd_serialize return notify.return_value; } -int async_recv(int fd, unsigned char* buff, int buff_len, bool read_once, bool fd_serialized) +int io::async_recv(int fd, unsigned char* buff, int buff_len, bool read_once, bool fd_serialized) { size_t offset = 0; @@ -388,7 +388,7 @@ int async_recv(int fd, unsigned char* buff, int buff_len, bool read_once, bool f return notify.curr_offset; } -int async_send(int fd, unsigned char* buff, int buff_len, bool fd_serialized) +int io::async_send(int fd, unsigned char* buff, int buff_len, bool fd_serialized) { size_t offset = 0; @@ -463,7 +463,7 @@ static std::mutex io_uring_mutex; static std::vector<aio_handle*> overflow_queue; static std::mutex overflow_queue_mutex; -int async_read_file(int fd, unsigned char* buff, size_t count, off_t offset) { +int io::async_read_file(int fd, unsigned char* buff, size_t count, off_t offset) { aio_handle notify; notify.op = aio_op::uring_read; @@ -504,7 +504,7 @@ int async_read_file(int fd, unsigned char* buff, size_t count, off_t offset) { return notify.return_value; } -int async_write_file(int fd, const unsigned char* buff, size_t count, off_t offset) { +int io::async_write_file(int fd, const unsigned char* buff, size_t count, off_t offset) { aio_handle notify; notify.op = aio_op::uring_write; @@ -667,7 +667,7 @@ void handle_aio_event(aio_handle *notify, int result = -1) { } } -void run_epoll_thread() +void io::run_epoll_thread() { setup_epoll(); setup_io_uring(); diff --git a/emper/AsyncLibrary.hpp b/emper/AsyncLibrary.hpp index 65152f10c1cf4eae32fbd4aafc85e8586841fb31..fded71d50ab928ad8104f238908b2feb88dcbd2c 100644 --- a/emper/AsyncLibrary.hpp +++ b/emper/AsyncLibrary.hpp @@ -3,6 +3,7 @@ #include "emper-config.h" #include <sys/socket.h> +namespace io { /** * @param fd filedescriptor for this operation * @param buff destination buffer @@ -48,3 +49,5 @@ int async_write_file(int fd, const unsigned char* buff, size_t count, off_t offs // Internal, move to somewhere else void run_epoll_thread(); #endif + +} diff --git a/emper/Runtime.cpp b/emper/Runtime.cpp index b6aab4350c6f69997b73777808b4d967faf40947..f861dc26deddb86b3b88e0af6b74530998cbb4ad 100644 --- a/emper/Runtime.cpp +++ b/emper/Runtime.cpp @@ -122,7 +122,7 @@ Fiber* Runtime::nextFiber() { void Runtime::waitUntilFinished() { #ifdef EMPER_ASYNC_LIB - run_epoll_thread(); + io::run_epoll_thread(); #endif for (workerid_t i = 0; i < workerCount; ++i) { pthread_join(threads[i], nullptr); diff --git a/tests/SimpleDiskAndNetworkTest.cpp b/tests/SimpleDiskAndNetworkTest.cpp index eff621b52fd73fadd9a8a93c9ac535b0a0f2abf9..e8d4566df8a34778593caeb173709f19d59e2351 100644 --- a/tests/SimpleDiskAndNetworkTest.cpp +++ b/tests/SimpleDiskAndNetworkTest.cpp @@ -29,6 +29,8 @@ #include "emper.hpp" #include "AsyncLibrary.hpp" +using namespace io; + #define MAX 1024 void func() diff --git a/tests/SimpleNetworkTest.cpp b/tests/SimpleNetworkTest.cpp index b746c4b750ec389a09c71446e0597afd08cd7790..343ce9cc220a30647ac000e55eb05e119e8faa0e 100644 --- a/tests/SimpleNetworkTest.cpp +++ b/tests/SimpleNetworkTest.cpp @@ -27,6 +27,7 @@ #include "emper.hpp" #include "AsyncLibrary.hpp" +using namespace io; #define MAX 1024 void func()