Sane C++ Libraries
C++ Platform Abstraction Libraries
Loading...
Searching...
No Matches
FileSystemWatcherAsync.h
1// Copyright (c) Stefano Cristiano
2// SPDX-License-Identifier: MIT
3#pragma once
4
5#include "../Async/Async.h"
6#include "../FileSystemWatcher/FileSystemWatcher.h"
7
8namespace SC
9{
10
13
16
30{
31 void init(AsyncEventLoop& loop) { eventLoop = &loop; }
32
33 protected:
34 AsyncEventLoop* eventLoop = nullptr;
35
36#if SC_PLATFORM_APPLE
37 virtual Result appleStartWakeUp() override;
38 virtual void appleSignalEventObject() override;
39 virtual Result appleWakeUpAndWait() override;
40
41 void onEventLoopNotification(AsyncLoopWakeUp::Result& result);
42
43 AsyncLoopWakeUp asyncWakeUp = {};
44 EventObject eventObject = {};
45#elif SC_PLATFORM_LINUX
46 virtual Result linuxStartSharedFilePoll() override;
47 virtual Result linuxStopSharedFilePoll() override;
48
49 void onEventLoopNotification(AsyncFilePoll::Result& result);
50
51 AsyncFilePoll asyncPoll = {};
52
53#else
55 virtual Result windowsStartFolderFilePoll(FolderWatcher& watcher, void* handle) override;
56 virtual Result windowsStopFolderFilePoll(FolderWatcher& watcher) override;
57 virtual void* windowsGetOverlapped(FolderWatcher& watcher) override;
58
59 void onEventLoopNotification(AsyncFilePoll::Result& result);
60 Function<void(AsyncResult&)> onClose;
61#endif
62};
64
65} // namespace SC
Asynchronous I/O (files, sockets, timers, processes, fs events, threads wake-up) (see Async) AsyncEve...
Definition Async.h:1187
Starts an handle polling operation.
Definition Async.h:820
Starts a wake-up operation, allowing threads to execute callbacks on loop thread.
Definition Async.h:339
Helper holding CompletionData for a specific AsyncRequest-derived class.
Definition Async.h:288
Base class for all async results (argument of completion callbacks).
Definition Async.h:258
An automatically reset event object to synchronize two threads.
Definition Threading.h:174
FileSystemWatcherAsync is an implementation of SC::FileSystemWatcher that uses SC::Async.
Definition FileSystemWatcherAsync.h:30
Abstract class to use event loop notifications (see SC::FileSystemWatcherAsync).
Definition FileSystemWatcher.h:166
Represents a single folder being watched.
Definition FileSystemWatcher.h:129
Wraps function pointers, member functions and lambdas without ever allocating.
Definition Function.h:19
An ascii string used as boolean result. SC_TRY macro forwards errors to caller.
Definition Result.h:12