Review updates (documentation, namespace naming)

This commit is contained in:
Marko Budiselic 2017-01-12 19:42:52 +01:00
parent 057af7ac14
commit b1c293ef72
3 changed files with 10 additions and 4 deletions

View File

@ -48,6 +48,12 @@ using os_mask_t = int;
*/
using in_event_t = struct inotify_event;
constexpr uint64_t IN_HEADER_SIZE = sizeof(struct inotify_event);
/**
* The reason why here is 10 is because the memory space for the data
* has to be upfront reserved (C API). I've picked up 10 because it seems like
* a reasonable size and doesn't have to be configurable before compile or run
* time.
*/
constexpr uint64_t IN_BUFF_LEN = 10 * (IN_HEADER_SIZE + NAME_MAX + 1);
/**
@ -153,7 +159,7 @@ public:
inotify_fd_ = inotify_init();
if (inotify_fd_ == -1)
throw FSWatcherException("Unable to initialize inotify\n");
os_linux::set_non_blocking(inotify_fd_);
linux_os::set_non_blocking(inotify_fd_);
}
~FSWatcher()

View File

@ -19,7 +19,7 @@
#include "utils/exceptions/not_yet_implemented.hpp"
#include "utils/likely.hpp"
namespace os_linux
namespace linux_os
{
class LinuxException : public BasicException
{

View File

@ -62,7 +62,7 @@ TEST(FSWatcherTest, CreateDeleteLoop)
// time distance between two actions should be big enough otherwise
// one event will hide another one
ms action_delta = watcher.check_interval() * 2;
ms action_delta = watcher.check_interval() * 3;
// watchers
watcher.watch(WatchDescriptor(working_dir, FSEventType::Created),
@ -100,7 +100,7 @@ TEST(FSWatcherTest, ModifiyLoop)
// parameters
int iterations = 10;
int modified_no = 0;
ms action_delta = watcher.check_interval() * 2;
ms action_delta = watcher.check_interval() * 3;
watcher.watch(WatchDescriptor(working_dir, FSEventType::Modified),
[&](FSEvent) { modified_no++; });