uvw  2.12.1
fs_poll.h
1 #ifndef UVW_FS_POLL_INCLUDE_H
2 #define UVW_FS_POLL_INCLUDE_H
3 
4 #include <chrono>
5 #include <string>
6 #include <uv.h>
7 #include "handle.hpp"
8 #include "loop.h"
9 #include "util.h"
10 
11 namespace uvw {
12 
18 struct FsPollEvent {
19  explicit FsPollEvent(Stat previous, Stat current) noexcept;
20 
23 };
24 
34 class FsPollHandle final: public Handle<FsPollHandle, uv_fs_poll_t> {
35  static void startCallback(uv_fs_poll_t *handle, int status, const uv_stat_t *prev, const uv_stat_t *curr);
36 
37 public:
38  using Time = std::chrono::duration<unsigned int, std::milli>;
39 
40  using Handle::Handle;
41 
46  bool init();
47 
56  void start(const std::string &file, Time interval);
57 
61  void stop();
62 
68  std::string path() noexcept;
69 };
70 
71 } // namespace uvw
72 
73 #ifndef UVW_AS_LIB
74 # include "fs_poll.cpp"
75 #endif
76 
77 #endif // UVW_FS_POLL_INCLUDE_H
The FsPollHandle handle.
Definition: fs_poll.h:34
bool init()
Initializes the handle.
std::string path() noexcept
Gets the path being monitored by the handle.
void start(const std::string &file, Time interval)
Starts the handle.
void stop()
Stops the handle.
Handle base class.
Definition: handle.hpp:26
uvw default namespace.
Definition: async.h:8
uv_stat_t Stat
Definition: util.h:215
FsPollEvent event.
Definition: fs_poll.h:18