Permalink
Browse files

o Some readme tweaks and readability improvements.

  • Loading branch information...
1 parent ab44304 commit 6c6dedb8bc81203529a9884b4ecf6bb3e3501981 @hzeller committed Sep 16, 2012
Showing with 11 additions and 12 deletions.
  1. +1 −1 README
  2. +7 −10 file-handler-cache.cc
  3. +2 −0 folve-filesystem.cc
  4. +1 −1 folve-main.cc
View
2 README
@@ -50,7 +50,7 @@ JConvolver Jack audio convolver http://apps.linuxaudio.org/apps/all/jconvolver
LibSndfile r/w audio files http://www.mega-nerd.com/libsndfile/
Microhttpd webserver library http://www.gnu.org/software/libmicrohttpd/
-=== Compiling on Ubuntu 12.04 ===
+=== Compiling on Ubuntu (tested on 11.10 and 12.04) ===
This requires the latest versions of libfuse and libzita convolver to compile.
.. and a couple of other libs:
View
@@ -79,7 +79,7 @@ void FileHandlerCache::SetObserver(Observer *observer) {
void FileHandlerCache::GetStats(std::vector<HandlerStats> *stats) {
HandlerStats s;
- mutex_.lock();
+ boost::lock_guard<boost::mutex> l(mutex_);
for (CacheMap::iterator it = cache_.begin(); it != cache_.end(); ++it) {
it->second->handler->GetHandlerStatus(&s);
s.status = ((it->second->references == 0)
@@ -88,22 +88,20 @@ void FileHandlerCache::GetStats(std::vector<HandlerStats> *stats) {
s.last_access = it->second->last_access;
stats->push_back(s);
}
- mutex_.unlock();
}
-struct FileHandlerCache::CompareAge {
- bool operator() (const CacheMap::iterator &a, const CacheMap::iterator &b) {
- return a->second->last_access < b->second->last_access;
- }
-};
-
void FileHandlerCache::Erase_Locked(CacheMap::iterator &cache_it) {
if (observer_) observer_->RetireHandlerEvent(cache_it->second->handler);
delete cache_it->second->handler; // FileHandler
delete cache_it->second; // Entry
cache_.erase(cache_it);
}
+struct FileHandlerCache::CompareAge {
+ bool operator() (const CacheMap::iterator &a, const CacheMap::iterator &b) {
+ return a->second->last_access < b->second->last_access;
+ }
+};
void FileHandlerCache::CleanupOldestUnreferenced_Locked() {
assert(cache_.size() > max_size_); // otherwise we shouldn't have been called
// While this iterating through the whole cache might look expensive,
@@ -112,8 +110,7 @@ void FileHandlerCache::CleanupOldestUnreferenced_Locked() {
// we need to keep better track of age.
std::vector<CacheMap::iterator> for_removal;
for (CacheMap::iterator it = cache_.begin(); it != cache_.end(); ++it) {
- if (it->second->references > 0) continue;
- for_removal.push_back(it);
+ if (it->second->references == 0) for_removal.push_back(it);
}
const size_t to_erase_count = std::min(cache_.size() - max_size_,
View
@@ -28,11 +28,13 @@
#include <map>
#include <string>
+#include <zita-convolver.h>
#include "conversion-buffer.h"
#include "file-handler-cache.h"
#include "file-handler.h"
#include "util.h"
+
#include "zita-config.h"
using folve::Appendf;
View
@@ -33,7 +33,7 @@
#define FOLVE_VERSION "v. 0.8 &mdash; 2012-09-15"
-// Compilation unit variables to communicate with the
+// Compilation unit variables to communicate with the fuse callbacks.
static FolveFilesystem *folve_fs = NULL;
static const char *underlying_dir = NULL;

0 comments on commit 6c6dedb

Please sign in to comment.