uvw 3.1.0
Loading...
Searching...
No Matches
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 "config.h"
8#include "handle.hpp"
9#include "loop.h"
10#include "util.h"
11
12namespace uvw {
13
16 explicit fs_poll_event(file_info previous, file_info current) noexcept;
17
20};
21
31class fs_poll_handle final: public handle<fs_poll_handle, uv_fs_poll_t, fs_poll_event> {
32 static void start_callback(uv_fs_poll_t *hndl, int status, const uv_stat_t *prev, const uv_stat_t *curr);
33
34public:
35 using time = std::chrono::duration<unsigned int, std::milli>;
36
37 using handle::handle;
38
43 int init() final;
44
54 int start(const std::string &file, time interval);
55
60 int stop();
61
67 std::string path() noexcept;
68};
69
70} // namespace uvw
71
72#ifndef UVW_AS_LIB
73# include "fs_poll.cpp"
74#endif
75
76#endif // UVW_FS_POLL_INCLUDE_H
The fs poll handle.
Definition: fs_poll.h:31
int start(const std::string &file, time interval)
Starts the handle.
std::string path() noexcept
Gets the path being monitored by the handle.
int init() final
Initializes the handle.
int stop()
Stops the handle.
Handle base class.
Definition: handle.hpp:23
uvw default namespace.
Definition: async.h:8
uv_stat_t file_info
Definition: util.h:96
Fs pos event.
Definition: fs_poll.h:15
file_info curr
Definition: fs_poll.h:19
file_info prev
Definition: fs_poll.h:18