Added global app_server port, so that other parts of the server don't have

to search for it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-05-27 13:36:05 +00:00
parent a4ad43aa83
commit 2724858b5b
3 changed files with 43 additions and 44 deletions
+9 -2
View File
@@ -73,6 +73,8 @@
Desktop *desktop;
port_id gAppServerPort;
// TODO: Global ? Is it really needed ?
//! Used to access the app_server from new_decorator
AppServer *app_server=NULL;
@@ -101,6 +103,8 @@ AppServer::AppServer(void) :
if (fMessagePort == B_NO_MORE_PORTS)
debugger("app_server could not create message port");
gAppServerPort = fMessagePort;
// Create the input port. The input_server will send it's messages here.
// TODO: If we want multiple user support we would need an individual
// port for each user and do the following for each RootLayer.
@@ -169,7 +173,6 @@ AppServer::AppServer(void) :
fontserver->Unlock();
// Load the GUI colors here and set the global set to the values contained therein. If this
// is not possible, set colors to the defaults
if (!LoadGUIColors(&gui_colorset))
@@ -878,6 +881,10 @@ AppServer::FindApp(const char *sig)
return NULL;
}
// #pragma mark -
/*!
\brief Creates a new decorator instance
\param rect Frame size
@@ -919,7 +926,7 @@ int
main(int argc, char** argv)
{
// There can be only one....
if (find_port(SERVER_PORT_NAME) != B_NAME_NOT_FOUND)
if (find_port(SERVER_PORT_NAME) >= B_OK)
return -1;
srand(real_time_clock_usecs());
+13 -6
View File
@@ -1,5 +1,11 @@
#ifndef _OPENBEOS_APP_SERVER_H_
#define _OPENBEOS_APP_SERVER_H_
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Author: DarkWyrm <[email protected]>
*/
#ifndef _HAIKU_APP_SERVER_H_
#define _HAIKU_APP_SERVER_H_
#include <OS.h>
#include <Locker.h>
@@ -26,10 +32,10 @@ class BitmapManager;
application start and quit messages. It also starts the housekeeping threads
and initializes most of the server's globals.
*/
#if TEST_MODE
class AppServer : public BApplication
#else
class AppServer
#if TEST_MODE
: public BApplication
#endif
{
public:
@@ -94,5 +100,6 @@ Decorator *new_decorator(BRect rect, const char *title, int32 wlook, int32 wfeel
extern BitmapManager *bitmapmanager;
extern ColorSet gui_colorset;
extern AppServer *app_server;
extern port_id gAppServerPort;
#endif
#endif /* _HAIKU_APP_SERVER_H_ */
+3 -18
View File
@@ -216,12 +216,7 @@ ServerApp::PingTarget(void)
{
team_info tinfo;
if (get_team_info(fClientTeamID,&tinfo) == B_BAD_TEAM_ID) {
port_id serverport = find_port(SERVER_PORT_NAME);
if (serverport == B_NAME_NOT_FOUND) {
printf("PANIC: ServerApp %s could not find the app_server port in PingTarget()!\n",fSignature.String());
return false;
}
fMsgSender->SetPort(serverport);
fMsgSender->SetPort(gAppServerPort);
fMsgSender->StartMessage(AS_DELETE_APP);
fMsgSender->Attach(&fMonitorThreadID, sizeof(thread_id));
fMsgSender->Flush();
@@ -308,12 +303,7 @@ ServerApp::MonitorApp(void *data)
STRACE(("ServerApp::MonitorApp(): GetNextMessage returned %s\n", strerror(err)));
// ToDo: this should kill the app, but it doesn't work
port_id serverport = find_port(SERVER_PORT_NAME);
if (serverport == B_NAME_NOT_FOUND){
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->fSignature.String());
break;
}
app->fMsgSender->SetPort(serverport);
app->fMsgSender->SetPort(gAppServerPort);
app->fMsgSender->StartMessage(AS_DELETE_APP);
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
app->fMsgSender->Flush();
@@ -393,12 +383,7 @@ ServerApp::MonitorApp(void *data)
STRACE(("ServerApp %s: B_QUIT_REQUESTED\n",app->fSignature.String()));
// Our BApplication sent us this message when it quit.
// We need to ask the app_server to delete ourself.
port_id serverport = find_port(SERVER_PORT_NAME);
if (serverport == B_NAME_NOT_FOUND){
printf("PANIC: ServerApp %s could not find the app_server port!\n",app->fSignature.String());
break;
}
app->fMsgSender->SetPort(serverport);
app->fMsgSender->SetPort(gAppServerPort);
app->fMsgSender->StartMessage(AS_DELETE_APP);
app->fMsgSender->Attach(&app->fMonitorThreadID, sizeof(thread_id));
app->fMsgSender->Flush();