windows powerfail signal: stop indexing only on resume and topdirs change

This commit is contained in:
Jean-Francois Dockes
2019-03-19 14:38:57 +01:00
parent d2b8eb6d80
commit 4d7d1a7965
6 changed files with 80 additions and 39 deletions
+7 -5
View File
@@ -168,12 +168,14 @@ LRESULT CALLBACK MainWndProc(HWND hwnd , UINT msg , WPARAM wParam,
case WM_POWERBROADCAST:
{
LOGDEB("MainWndProc: got powerbroadcast message\n");
// We always try to end an indexing operation, independantly
// of the kind of event. Mounted volumes may have changed
// etc. Using SIGTERM just to have something different from
// the other messages
// This gets specific processing because we want to check the
// state of topdirs on resuming indexing (in case a mounted
// volume went away).
if (l_sigcleanup) {
l_sigcleanup(SIGTERM);
if (wParam == PBT_APMRESUMEAUTOMATIC ||
wParam == PBT_APMRESUMESUSPEND) {
l_sigcleanup(RCLSIG_RESUME);
}
}
}
break;
+8
View File
@@ -41,6 +41,14 @@ class RclConfig;
*/
enum RclInitFlags {RCLINIT_NONE = 0, RCLINIT_DAEMON = 1, RCLINIT_IDX = 2,
RCLINIT_PYTHON = 4};
// Kinds of termination requests, in addition to the normal signal
// values. Passed as type int to sigcleanup() when it is not invoked
// directly as a sig handler. Note that because of the existence of
// sigset_t, we are pretty sure that no signals can have a high value
enum RclSigKind {
// System resume from sleep
RCLSIG_RESUME = 1002};
extern RclConfig *recollinit(int flags,
void (*cleanup)(void), void (*sigcleanup)(int),
std::string& reason, const std::string *argcnf = 0);