From 1199f321eaf064d8be34512e4cb6b6cf136ede99 Mon Sep 17 00:00:00 2001 From: Dario Casalinuovo Date: Fri, 1 Apr 2016 16:46:13 +0200 Subject: [PATCH] media_server: Initial move to BServer --- src/servers/media/Jamfile | 2 +- src/servers/media/media_server.cpp | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/servers/media/Jamfile b/src/servers/media/Jamfile index c5edb718a8..aa638ee2e5 100644 --- a/src/servers/media/Jamfile +++ b/src/servers/media/Jamfile @@ -2,7 +2,7 @@ SubDir HAIKU_TOP src servers media ; SetSubDirSupportedPlatformsBeOSCompatible ; -UsePrivateHeaders media shared storage ; +UsePrivateHeaders media shared storage app ; UsePrivateSystemHeaders ; AddResources media_server : media_server.rdef ; diff --git a/src/servers/media/media_server.cpp b/src/servers/media/media_server.cpp index f4d7dd60dc..9ed51d5356 100644 --- a/src/servers/media/media_server.cpp +++ b/src/servers/media/media_server.cpp @@ -37,7 +37,7 @@ char __dont_remove_copyright_from_binary[] = "Copyright (c) 2002, 2003 " #include #include -#include +#include #include #include #include @@ -69,10 +69,10 @@ NotificationManager* gNotificationManager; #define REPLY_TIMEOUT ((bigtime_t)500000) -class ServerApp : BApplication { +class ServerApp : public BServer { public: - ServerApp(); - ~ServerApp(); + ServerApp(status_t& error); + virtual ~ServerApp(); protected: virtual void ArgvReceived(int32 argc, char** argv); @@ -89,7 +89,7 @@ private: private: port_id _ControlPort() const { return fControlPort; } - static int32 _ControlThread(void* arg); + static int32 _ControlThread(void* arg); BLocker fLocker; port_id fControlPort; @@ -97,9 +97,9 @@ private: }; -ServerApp::ServerApp() +ServerApp::ServerApp(status_t& error) : - BApplication(B_MEDIA_SERVER_SIGNATURE), + BServer(B_MEDIA_SERVER_SIGNATURE, true, &error), fLocker("media server locker") { gNotificationManager = new NotificationManager; @@ -971,8 +971,11 @@ ServerApp::MessageReceived(BMessage* msg) int main() { - new ServerApp; - be_app->Run(); - delete be_app; - return 0; + status_t status; + ServerApp app(status); + + if (status == B_OK) + app.Run(); + + return status == B_OK ? EXIT_SUCCESS : EXIT_FAILURE; }