midi_server: Converted to BServer, launched on demand.

This commit is contained in:
Axel Dörfler 2015-10-14 21:47:54 +02:00
parent 83f803c6ff
commit 8f27961801
4 changed files with 23 additions and 11 deletions

View File

@ -40,7 +40,7 @@ service x-vnd.Haiku-media_server {
service x-vnd.Haiku-midi_server {
launch /system/servers/midi_server
no_safemode
legacy
on_demand
}
service x-vnd.Haiku-mail_daemon {

View File

@ -2,7 +2,7 @@ SubDir HAIKU_TOP src servers midi ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateHeaders midi shared storage ;
UsePrivateHeaders app midi shared storage ;
Server midi_server :
MidiServerApp.cpp

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
*
@ -36,9 +44,9 @@
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"))
@ -816,7 +824,11 @@ MidiServerApp::_DumpEndpoints()
int
main()
{
MidiServerApp app;
app.Run();
return 0;
status_t status;
MidiServerApp app(status);
if (status == B_OK)
app.Run();
return status == B_OK ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@ -9,7 +9,7 @@
#define MIDI_SERVER_APP_H
#include <Application.h>
#include <Server.h>
#include <List.h>
#include "DeviceWatcher.h"
@ -24,16 +24,16 @@ struct endpoint_t;
incoming messages from libmidi2.so, and notifies the apps
when something interesting happens.
*/
class MidiServerApp : public BApplication {
class MidiServerApp : public BServer {
public:
MidiServerApp();
MidiServerApp(status_t& error);
virtual ~MidiServerApp();
virtual void AboutRequested();
virtual void MessageReceived(BMessage* msg);
private:
typedef BApplication super;
typedef BServer super;
void _OnRegisterApp(BMessage* msg);
void _OnCreateEndpoint(BMessage* msg);