aboutsummaryrefslogtreecommitdiff
path: root/src/AsyncEventLoop.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-23 19:48:53 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-23 21:47:03 +0530
commit346c16b4e2ea26f47e0e370a490b7794492a9ebb (patch)
tree277a30ac8b0c82a9c9736985385d0d150a55fcb5 /src/AsyncEventLoop.hpp
parent9cc72e8ea9f59f9a9627d05528d54a559ebd412c (diff)
downloadnull-browser-346c16b4e2ea26f47e0e370a490b7794492a9ebb.tar.gz
null-browser-346c16b4e2ea26f47e0e370a490b7794492a9ebb.zip
Apply clang-tidy suggestions
Diffstat (limited to 'src/AsyncEventLoop.hpp')
-rw-r--r--src/AsyncEventLoop.hpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/AsyncEventLoop.hpp b/src/AsyncEventLoop.hpp
index 8082dfa..7a3ed69 100644
--- a/src/AsyncEventLoop.hpp
+++ b/src/AsyncEventLoop.hpp
@@ -16,30 +16,28 @@ public:
~AsyncEventLoop();
void wake();
- DEFINE_GETTER(getUVLoop, loop)
+ DEFINE_GETTER(get_uv_loop, loop)
- template <typename F> void queueTask(F &&task) {
+ template <typename F> void queue_task(F &&task) {
{
- std::lock_guard<std::mutex> lock(tasksQueueMutex);
- tasksQueue.push(std::forward<F>(task));
+ const std::lock_guard<std::mutex> lock(tasks_queue_mutex);
+ tasks_queue.push(std::forward<F>(task));
}
wake();
}
protected:
- void runLoop();
- void processTasks();
- static void asyncHandleCallback(uv_async_t *handle);
- static void closeHandle(uv_handle_t *handle, void *arg = nullptr);
-
-private:
- void flushTasks();
+ void run_loop();
+ void process_tasks();
+ void flush_tasks();
+ static void async_handle_callback(uv_async_t *handle);
+ static void close_handle(uv_handle_t *handle, void *arg = nullptr);
private:
uv_loop_t *loop;
- std::thread loopThread;
- uv_async_t asyncHandle;
- std::atomic<bool> isLoopRunning = false;
- std::queue<std::function<void()>> tasksQueue;
- std::mutex tasksQueueMutex;
+ std::thread loop_thread;
+ uv_async_t async_handle;
+ std::atomic<bool> is_loop_running = false;
+ std::queue<std::function<void()>> tasks_queue;
+ std::mutex tasks_queue_mutex;
};