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
b4d594ee
Commit
b4d594ee
authored
Mar 05, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Instance: embed EventLoop, no pointer
parent
ce09379b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
21 deletions
+15
-21
Instance.cxx
src/Instance.cxx
+0
-7
Instance.hxx
src/Instance.hxx
+5
-2
Main.cxx
src/Main.cxx
+10
-12
No files found.
src/Instance.cxx
View file @
b4d594ee
...
@@ -22,7 +22,6 @@
...
@@ -22,7 +22,6 @@
#include "Partition.hxx"
#include "Partition.hxx"
#include "Idle.hxx"
#include "Idle.hxx"
#include "Stats.hxx"
#include "Stats.hxx"
#include "event/Loop.hxx"
#include "util/Error.hxx"
#include "util/Error.hxx"
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
...
@@ -35,12 +34,6 @@
...
@@ -35,12 +34,6 @@
#endif
#endif
#endif
#endif
void
Instance
::
Shutdown
()
{
event_loop
->
Break
();
}
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
Database
*
Database
*
...
...
src/Instance.hxx
View file @
b4d594ee
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#define MPD_INSTANCE_HXX
#define MPD_INSTANCE_HXX
#include "check.h"
#include "check.h"
#include "event/Loop.hxx"
#include "Compiler.h"
#include "Compiler.h"
#ifdef ENABLE_NEIGHBOR_PLUGINS
#ifdef ENABLE_NEIGHBOR_PLUGINS
...
@@ -54,7 +55,7 @@ struct Instance final
...
@@ -54,7 +55,7 @@ struct Instance final
public
NeighborListener
public
NeighborListener
#endif
#endif
{
{
EventLoop
*
event_loop
;
EventLoop
event_loop
;
#ifdef ENABLE_NEIGHBOR_PLUGINS
#ifdef ENABLE_NEIGHBOR_PLUGINS
NeighborGlue
*
neighbors
;
NeighborGlue
*
neighbors
;
...
@@ -79,7 +80,9 @@ struct Instance final
...
@@ -79,7 +80,9 @@ struct Instance final
/**
/**
* Initiate shutdown. Wrapper for EventLoop::Break().
* Initiate shutdown. Wrapper for EventLoop::Break().
*/
*/
void
Shutdown
();
void
Shutdown
()
{
event_loop
.
Break
();
}
#ifdef ENABLE_DATABASE
#ifdef ENABLE_DATABASE
/**
/**
...
...
src/Main.cxx
View file @
b4d594ee
...
@@ -190,7 +190,7 @@ glue_db_init_and_load(void)
...
@@ -190,7 +190,7 @@ glue_db_init_and_load(void)
{
{
Error
error
;
Error
error
;
instance
->
database
=
instance
->
database
=
CreateConfiguredDatabase
(
*
instance
->
event_loop
,
*
instance
,
CreateConfiguredDatabase
(
instance
->
event_loop
,
*
instance
,
error
);
error
);
if
(
instance
->
database
==
nullptr
)
{
if
(
instance
->
database
==
nullptr
)
{
if
(
error
.
IsDefined
())
if
(
error
.
IsDefined
())
...
@@ -225,7 +225,7 @@ glue_db_init_and_load(void)
...
@@ -225,7 +225,7 @@ glue_db_init_and_load(void)
return
true
;
return
true
;
SimpleDatabase
&
db
=
*
(
SimpleDatabase
*
)
instance
->
database
;
SimpleDatabase
&
db
=
*
(
SimpleDatabase
*
)
instance
->
database
;
instance
->
update
=
new
UpdateService
(
*
instance
->
event_loop
,
db
,
instance
->
update
=
new
UpdateService
(
instance
->
event_loop
,
db
,
static_cast
<
CompositeStorage
&>
(
*
instance
->
storage
),
static_cast
<
CompositeStorage
&>
(
*
instance
->
storage
),
*
instance
);
*
instance
);
...
@@ -287,7 +287,7 @@ glue_state_file_init(Error &error)
...
@@ -287,7 +287,7 @@ glue_state_file_init(Error &error)
state_file
=
new
StateFile
(
std
::
move
(
path_fs
),
interval
,
state_file
=
new
StateFile
(
std
::
move
(
path_fs
),
interval
,
*
instance
->
partition
,
*
instance
->
partition
,
*
instance
->
event_loop
);
instance
->
event_loop
);
state_file
->
Read
();
state_file
->
Read
();
return
true
;
return
true
;
}
}
...
@@ -468,7 +468,6 @@ int mpd_main(int argc, char *argv[])
...
@@ -468,7 +468,6 @@ int mpd_main(int argc, char *argv[])
}
}
instance
=
new
Instance
();
instance
=
new
Instance
();
instance
->
event_loop
=
new
EventLoop
();
#ifdef ENABLE_NEIGHBOR_PLUGINS
#ifdef ENABLE_NEIGHBOR_PLUGINS
instance
->
neighbors
=
new
NeighborGlue
();
instance
->
neighbors
=
new
NeighborGlue
();
...
@@ -489,7 +488,7 @@ int mpd_main(int argc, char *argv[])
...
@@ -489,7 +488,7 @@ int mpd_main(int argc, char *argv[])
initialize_decoder_and_player
();
initialize_decoder_and_player
();
if
(
!
listen_global_init
(
*
instance
->
event_loop
,
*
instance
->
partition
,
if
(
!
listen_global_init
(
instance
->
event_loop
,
*
instance
->
partition
,
error
))
{
error
))
{
LogError
(
error
);
LogError
(
error
);
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
...
@@ -521,7 +520,7 @@ static int mpd_main_after_fork(struct options options)
...
@@ -521,7 +520,7 @@ static int mpd_main_after_fork(struct options options)
try
{
try
{
Error
error
;
Error
error
;
GlobalEvents
::
Initialize
(
*
instance
->
event_loop
);
GlobalEvents
::
Initialize
(
instance
->
event_loop
);
GlobalEvents
::
Register
(
GlobalEvents
::
IDLE
,
idle_event_emitted
);
GlobalEvents
::
Register
(
GlobalEvents
::
IDLE
,
idle_event_emitted
);
if
(
!
ConfigureFS
(
error
))
{
if
(
!
ConfigureFS
(
error
))
{
...
@@ -556,7 +555,7 @@ try {
...
@@ -556,7 +555,7 @@ try {
command_init
();
command_init
();
initAudioConfig
();
initAudioConfig
();
instance
->
partition
->
outputs
.
Configure
(
*
instance
->
event_loop
,
instance
->
partition
->
outputs
.
Configure
(
instance
->
event_loop
,
instance
->
partition
->
pc
);
instance
->
partition
->
pc
);
client_manager_init
();
client_manager_init
();
replay_gain_global_init
();
replay_gain_global_init
();
...
@@ -575,7 +574,7 @@ try {
...
@@ -575,7 +574,7 @@ try {
#ifndef ANDROID
#ifndef ANDROID
setup_log_output
(
options
.
log_stderr
);
setup_log_output
(
options
.
log_stderr
);
SignalHandlersInit
(
*
instance
->
event_loop
);
SignalHandlersInit
(
instance
->
event_loop
);
#endif
#endif
io_thread_start
();
io_thread_start
();
...
@@ -586,7 +585,7 @@ try {
...
@@ -586,7 +585,7 @@ try {
FatalError
(
error
);
FatalError
(
error
);
#endif
#endif
ZeroconfInit
(
*
instance
->
event_loop
);
ZeroconfInit
(
instance
->
event_loop
);
StartPlayerThread
(
instance
->
partition
->
pc
);
StartPlayerThread
(
instance
->
partition
->
pc
);
...
@@ -612,7 +611,7 @@ try {
...
@@ -612,7 +611,7 @@ try {
#ifdef ENABLE_INOTIFY
#ifdef ENABLE_INOTIFY
if
(
instance
->
storage
!=
nullptr
&&
if
(
instance
->
storage
!=
nullptr
&&
instance
->
update
!=
nullptr
)
instance
->
update
!=
nullptr
)
mpd_inotify_init
(
*
instance
->
event_loop
,
mpd_inotify_init
(
instance
->
event_loop
,
*
instance
->
storage
,
*
instance
->
storage
,
*
instance
->
update
,
*
instance
->
update
,
config_get_unsigned
(
ConfigOption
::
AUTO_UPDATE_DEPTH
,
config_get_unsigned
(
ConfigOption
::
AUTO_UPDATE_DEPTH
,
...
@@ -643,7 +642,7 @@ try {
...
@@ -643,7 +642,7 @@ try {
#endif
#endif
/* run the main loop */
/* run the main loop */
instance
->
event_loop
->
Run
();
instance
->
event_loop
.
Run
();
#ifdef WIN32
#ifdef WIN32
win32_app_stopping
();
win32_app_stopping
();
...
@@ -712,7 +711,6 @@ try {
...
@@ -712,7 +711,6 @@ try {
#ifndef ANDROID
#ifndef ANDROID
SignalHandlersFinish
();
SignalHandlersFinish
();
#endif
#endif
delete
instance
->
event_loop
;
delete
instance
;
delete
instance
;
instance
=
nullptr
;
instance
=
nullptr
;
...
...
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