midi_server: Converted to BServer, launched on demand.

This commit is contained in:
Axel Dörfler
2015-10-14 22:24:01 +02:00
parent 83f803c6ff
commit 8f27961801
4 changed files with 23 additions and 11 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ service x-vnd.Haiku-media_server {
service x-vnd.Haiku-midi_server { service x-vnd.Haiku-midi_server {
launch /system/servers/midi_server launch /system/servers/midi_server
no_safemode no_safemode
legacy on_demand
} }
service x-vnd.Haiku-mail_daemon { service x-vnd.Haiku-mail_daemon {
+1 -1
View File
@@ -2,7 +2,7 @@ SubDir HAIKU_TOP src servers midi ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders midi shared storage ; UsePrivateHeaders app midi shared storage ;
Server midi_server : Server midi_server :
MidiServerApp.cpp MidiServerApp.cpp
+17 -5
View File
@@ -1,3 +1,11 @@
/*
* Copyright 2002-2015, Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Matthijs Hollemans
*/
/* /*
* Copyright (c) 2002-2004 Matthijs Hollemans * Copyright (c) 2002-2004 Matthijs Hollemans
* *
@@ -36,9 +44,9 @@
using std::nothrow; using std::nothrow;
MidiServerApp::MidiServerApp() MidiServerApp::MidiServerApp(status_t& error)
: :
BApplication(MIDI_SERVER_SIGNATURE) BServer(MIDI_SERVER_SIGNATURE, true, &error)
{ {
TRACE(("Running Haiku MIDI server")) TRACE(("Running Haiku MIDI server"))
@@ -816,7 +824,11 @@ MidiServerApp::_DumpEndpoints()
int int
main() main()
{ {
MidiServerApp app; status_t status;
app.Run(); MidiServerApp app(status);
return 0;
if (status == B_OK)
app.Run();
return status == B_OK ? EXIT_SUCCESS : EXIT_FAILURE;
} }
+4 -4
View File
@@ -9,7 +9,7 @@
#define MIDI_SERVER_APP_H #define MIDI_SERVER_APP_H
#include <Application.h> #include <Server.h>
#include <List.h> #include <List.h>
#include "DeviceWatcher.h" #include "DeviceWatcher.h"
@@ -24,16 +24,16 @@ struct endpoint_t;
incoming messages from libmidi2.so, and notifies the apps incoming messages from libmidi2.so, and notifies the apps
when something interesting happens. when something interesting happens.
*/ */
class MidiServerApp : public BApplication { class MidiServerApp : public BServer {
public: public:
MidiServerApp(); MidiServerApp(status_t& error);
virtual ~MidiServerApp(); virtual ~MidiServerApp();
virtual void AboutRequested(); virtual void AboutRequested();
virtual void MessageReceived(BMessage* msg); virtual void MessageReceived(BMessage* msg);
private: private:
typedef BApplication super; typedef BServer super;
void _OnRegisterApp(BMessage* msg); void _OnRegisterApp(BMessage* msg);
void _OnCreateEndpoint(BMessage* msg); void _OnCreateEndpoint(BMessage* msg);