GlobalEvents: eliminate SHUTDOWN, use Instance::Shutdown() instead
This commit is contained in:
@@ -33,11 +33,6 @@ namespace GlobalEvents {
|
|||||||
/** the current song's tag has changed */
|
/** the current song's tag has changed */
|
||||||
TAG,
|
TAG,
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
/** shutdown requested */
|
|
||||||
SHUTDOWN,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MAX
|
MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
16
src/Main.cxx
16
src/Main.cxx
@@ -385,19 +385,6 @@ idle_event_emitted(void)
|
|||||||
state_file->CheckModified();
|
state_file->CheckModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for GlobalEvents::SHUTDOWN.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
shutdown_event_emitted(void)
|
|
||||||
{
|
|
||||||
instance->Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
@@ -536,9 +523,6 @@ try {
|
|||||||
|
|
||||||
GlobalEvents::Initialize(*instance->event_loop);
|
GlobalEvents::Initialize(*instance->event_loop);
|
||||||
GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted);
|
GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted);
|
||||||
#ifdef WIN32
|
|
||||||
GlobalEvents::Register(GlobalEvents::SHUTDOWN, shutdown_event_emitted);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ConfigureFS(error)) {
|
if (!ConfigureFS(error)) {
|
||||||
LogError(error);
|
LogError(error);
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
#include "GlobalEvents.hxx"
|
#include "Instance.hxx"
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@@ -71,7 +71,7 @@ service_dispatcher(gcc_unused DWORD control, gcc_unused DWORD event_type,
|
|||||||
switch (control) {
|
switch (control) {
|
||||||
case SERVICE_CONTROL_SHUTDOWN:
|
case SERVICE_CONTROL_SHUTDOWN:
|
||||||
case SERVICE_CONTROL_STOP:
|
case SERVICE_CONTROL_STOP:
|
||||||
GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
|
instance->Shutdown();
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
default:
|
default:
|
||||||
return NO_ERROR;
|
return NO_ERROR;
|
||||||
@@ -107,7 +107,7 @@ console_handler(DWORD event)
|
|||||||
// regardless our thread is still active.
|
// regardless our thread is still active.
|
||||||
// If this did not happen within 3 seconds
|
// If this did not happen within 3 seconds
|
||||||
// let's shutdown anyway.
|
// let's shutdown anyway.
|
||||||
GlobalEvents::Emit(GlobalEvents::SHUTDOWN);
|
instance->Shutdown();
|
||||||
// Under debugger it's better to wait indefinitely
|
// Under debugger it's better to wait indefinitely
|
||||||
// to allow debugging of shutdown code.
|
// to allow debugging of shutdown code.
|
||||||
Sleep(IsDebuggerPresent() ? INFINITE : 3000);
|
Sleep(IsDebuggerPresent() ? INFINITE : 3000);
|
||||||
|
Reference in New Issue
Block a user