Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0a888670
Commit
0a888670
authored
Oct 13, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Main: move top-level exception handler to main()
Allows win32_main() to throw exceptions.
parent
0712314d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
11 deletions
+13
-11
Main.cxx
src/Main.cxx
+8
-9
Main.hxx
src/Main.hxx
+1
-1
Win32Main.cxx
src/win32/Win32Main.cxx
+4
-1
No files found.
src/Main.cxx
View file @
0a888670
...
...
@@ -644,27 +644,26 @@ MainOrThrow(int argc, char *argv[])
MainConfigured
(
options
,
raw_config
);
}
int
mpd_main
(
int
argc
,
char
*
argv
[])
noexcept
int
mpd_main
(
int
argc
,
char
*
argv
[])
{
AtScopeExit
()
{
log_deinit
();
};
try
{
MainOrThrow
(
argc
,
argv
);
return
EXIT_SUCCESS
;
}
catch
(...)
{
LogError
(
std
::
current_exception
());
return
EXIT_FAILURE
;
}
}
int
main
(
int
argc
,
char
*
argv
[])
noexcept
{
try
{
AtScopeExit
()
{
log_deinit
();
};
#ifdef _WIN32
return
win32_main
(
argc
,
argv
);
#else
return
mpd_main
(
argc
,
argv
);
#endif
}
catch
(...)
{
LogError
(
std
::
current_exception
());
return
EXIT_FAILURE
;
}
#endif
src/Main.hxx
View file @
0a888670
...
...
@@ -40,7 +40,7 @@ extern Instance *global_instance;
* after doing some initialization.
*/
int
mpd_main
(
int
argc
,
char
*
argv
[])
noexcept
;
mpd_main
(
int
argc
,
char
*
argv
[]);
#endif
...
...
src/win32/Win32Main.cxx
View file @
0a888670
...
...
@@ -21,6 +21,7 @@
#include "util/Compiler.h"
#include "Instance.hxx"
#include "system/FatalError.hxx"
#include "Log.hxx"
#include <cstdlib>
#include <atomic>
...
...
@@ -76,7 +77,7 @@ service_dispatcher([[maybe_unused]] DWORD control, [[maybe_unused]] DWORD event_
static
void
WINAPI
service_main
([[
maybe_unused
]]
DWORD
argc
,
[[
maybe_unused
]]
LPTSTR
argv
[])
{
try
{
service_handle
=
RegisterServiceCtrlHandlerEx
(
service_name
,
service_dispatcher
,
nullptr
);
...
...
@@ -87,6 +88,8 @@ service_main([[maybe_unused]] DWORD argc, [[maybe_unused]] LPTSTR argv[])
service_notify_status
(
SERVICE_START_PENDING
);
mpd_main
(
service_argc
,
service_argv
);
service_notify_status
(
SERVICE_STOPPED
);
}
catch
(...)
{
LogError
(
std
::
current_exception
());
}
static
BOOL
WINAPI
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment