source: imaps-frontend/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.hh

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 937 bytes
Line 
1#ifndef KQUEUE_H
2#define KQUEUE_H
3
4#include <unordered_map>
5#include <sys/event.h>
6#include "../shared/BruteForceBackend.hh"
7#include "../DirTree.hh"
8#include "../Signal.hh"
9
10struct KqueueSubscription {
11 WatcherRef watcher;
12 std::string path;
13 std::shared_ptr<DirTree> tree;
14 int fd;
15};
16
17class KqueueBackend : public BruteForceBackend {
18public:
19 void start() override;
20 ~KqueueBackend();
21 void subscribe(WatcherRef watcher) override;
22 void unsubscribe(WatcherRef watcher) override;
23private:
24 int mKqueue;
25 int mPipe[2];
26 std::unordered_multimap<std::string, KqueueSubscription> mSubscriptions;
27 std::unordered_map<int, DirEntry *> mFdToEntry;
28 Signal mEndedSignal;
29
30 bool watchDir(WatcherRef watcher, std::string path, std::shared_ptr<DirTree> tree);
31 bool compareDir(int fd, std::string &dir, std::unordered_set<WatcherRef> &watchers);
32 std::vector<KqueueSubscription *> findSubscriptions(std::string &path);
33};
34
35#endif
Note: See TracBrowser for help on using the repository browser.