From c96bac9cb807f7c9b622a8304cb8e7e3c955d8b5 Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Tue, 25 Apr 2023 20:37:38 -0400 Subject: [PATCH] checkpoint --- libfuse/lib/bounded_queue.hpp | 22 +++++++++++----------- libfuse/lib/fuse_msgbuf.cpp | 5 +++-- libfuse/lib/thread_pool.hpp | 1 + 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libfuse/lib/bounded_queue.hpp b/libfuse/lib/bounded_queue.hpp index 3e58da77..5e5fa261 100644 --- a/libfuse/lib/bounded_queue.hpp +++ b/libfuse/lib/bounded_queue.hpp @@ -24,14 +24,14 @@ public: push(const T& item_) { { - std::unique_lock guard(_queue_lock); + std::unique_lock guard(_queue_lock); _condition_push.wait(guard, [&]() { return _queue.size() < _max_size || !_block; }); if(_queue.size() == _max_size) return false; - _queue.push(item); + _queue.push(item_); } _condition_pop.notify_one(); @@ -43,7 +43,7 @@ public: push(T&& item_) { { - std::unique_lock guard(_queue_lock); + std::unique_lock guard(_queue_lock); _condition_push.wait(guard, [&]() { return _queue.size() < _max_size || !_block; }); @@ -61,7 +61,7 @@ public: emplace(Args&&... args_) { { - std::unique_lock guard(_queue_lock); + std::unique_lock guard(_queue_lock); _condition_push.wait(guard, [&]() { return _queue.size() < _max_size || !_block; }); @@ -80,7 +80,7 @@ public: pop(T& item_) { { - std::unique_lock guard(_queue_lock); + std::unique_lock guard(_queue_lock); _condition_pop.wait(guard, [&]() { return !_queue.empty() || !_block; }); if(_queue.empty()) @@ -99,7 +99,7 @@ public: std::size_t size() const { - std::lock_guard guard(_queue_lock); + std::lock_guard guard(_queue_lock); return _queue.size(); } @@ -113,7 +113,7 @@ public: bool empty() const { - std::lock_guard guard(_queue_lock); + std::lock_guard guard(_queue_lock); return _queue.empty(); } @@ -121,7 +121,7 @@ public: bool full() const { - std::lock_guard lock(_queue_lock); + std::lock_guard lock(_queue_lock); return (_queue.size() == capacity()); } @@ -129,7 +129,7 @@ public: void block() { - std::lock_guard guard(_queue_lock); + std::lock_guard guard(_queue_lock); _block = true; } @@ -137,7 +137,7 @@ public: unblock() { { - std::lock_guard guard(_queue_lock); + std::lock_guard guard(_queue_lock); _block = false; } @@ -148,7 +148,7 @@ public: bool blocking() const { - std::lock_guard guard(_queue_lock); + std::lock_guard guard(_queue_lock); return _block; } diff --git a/libfuse/lib/fuse_msgbuf.cpp b/libfuse/lib/fuse_msgbuf.cpp index c90594af..60bff4f1 100644 --- a/libfuse/lib/fuse_msgbuf.cpp +++ b/libfuse/lib/fuse_msgbuf.cpp @@ -28,8 +28,9 @@ #include -static std::uint32_t g_PAGESIZE = 0; -static std::uint32_t g_BUFSIZE = 0; +static std::uint32_t g_PAGESIZE = 0; +static std::uint32_t g_BUFSIZE = 0; +static std::uint32_t g_MAX_ALLOCS = 128; static std::mutex g_MUTEX; static std::vector g_MSGBUF_STACK; diff --git a/libfuse/lib/thread_pool.hpp b/libfuse/lib/thread_pool.hpp index c8b5ac32..3737a186 100644 --- a/libfuse/lib/thread_pool.hpp +++ b/libfuse/lib/thread_pool.hpp @@ -1,6 +1,7 @@ #pragma once #include "unbounded_queue.hpp" +#include "bounded_queue.hpp" #include #include