1#ifndef NEFORCE_CORE_FILE_FILE_WATCHER_HPP__
2#define NEFORCE_CORE_FILE_FILE_WATCHER_HPP__
18NEFORCE_BEGIN_NAMESPACE__
44 mutex callback_mutex_;
46#ifdef NEFORCE_PLATFORM_WINDOWS
47 ::HANDLE dir_handle_ = INVALID_HANDLE_VALUE;
48 ::HANDLE completion_port_ = INVALID_HANDLE_VALUE;
52 int watch_descriptor_ = -1;
63 void watch_thread_func();
106 NEFORCE_NODISCARD
const path&
watch_path() const noexcept {
return watch_path_; }
118 NEFORCE_NODISCARD
bool is_watching() const noexcept {
return watching_.load(); }
124 NEFORCE_NODISCARD
bool is_recursive() const noexcept {
return recursive_; }
147NEFORCE_END_NAMESPACE__
NEFORCE_NODISCARD file_watch_event current_events() const noexcept
获取当前监视的事件类型
NEFORCE_NODISCARD const path & watch_path() const noexcept
获取监视的目录路径
bool update_recursive(bool recursive)
更新递归设置
NEFORCE_NODISCARD bool is_watching() const noexcept
检查是否正在监视
bool start(callback_t callback, file_watch_event events=file_watch_event::ALL)
开始监视
bool update_watch(file_watch_event events)
更新监视的事件类型
file_watcher(path watch_path, bool recursive=false)
构造函数
NEFORCE_NODISCARD bool is_recursive() const noexcept
检查是否递归监视子目录
@ OVERLAPPED
Linux不支持异步I/O标志