AppServer is no longer a friend of ServerApp. Small cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12586 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-05-07 15:56:15 +00:00
parent 3348baea8f
commit 04efb239b7
3 changed files with 30 additions and 17 deletions

View File

@ -93,7 +93,7 @@ AppServer::AppServer(void) :
fCursorSem(-1),
fCursorArea(-1)
{
fMessagePort= create_port(200, SERVER_PORT_NAME);
fMessagePort = create_port(200, SERVER_PORT_NAME);
if (fMessagePort == B_NO_MORE_PORTS)
debugger("app_server could not create message port");
@ -570,7 +570,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
BPortLink replylink(app_port);
replylink.StartMessage(SERVER_TRUE);
replylink.Attach<int32>(newapp->fMessagePort);
replylink.Attach<int32>(server_listen);
replylink.Flush();
// This is necessary because BPortLink::ReadString allocates memory
@ -603,7 +603,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
{
srvapp=(ServerApp *)fAppList->ItemAt(i);
if(srvapp != NULL && srvapp->fMonitorThreadID== srvapp_id)
if(srvapp != NULL && srvapp->MonitorThreadID() == srvapp_id)
{
srvapp=(ServerApp *)fAppList->RemoveItem(i);
if(srvapp)
@ -763,14 +763,14 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
// thread_id. We will only wait so long, because then the app is probably crashed
// or hung. Seeing that being the case, we'll kill its BApp team and fake the
// quit message
if(get_thread_info(app->fMonitorThreadID, &tinfo)==B_OK)
if(get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK)
{
bool killteam=true;
for(int32 j=0; j<5; j++)
{
snooze(500000); // wait half a second for it to quit
if(get_thread_info(app->fMonitorThreadID, &tinfo)!=B_OK)
if(get_thread_info(app->MonitorThreadID(), &tinfo)!=B_OK)
{
killteam=false;
break;
@ -856,7 +856,7 @@ ServerApp *AppServer::FindApp(const char *sig)
for(int32 i=0; i<fAppList->CountItems();i++)
{
foundapp=(ServerApp*)fAppList->ItemAt(i);
if(foundapp && foundapp->fSignature==sig)
if(foundapp && foundapp->Title() == sig)
{
release_sem(fAppListLock);
return foundapp;

View File

@ -25,6 +25,8 @@
//
//------------------------------------------------------------------------------
#include <AppDefs.h>
#include <LinkMsgReader.h>
#include <LinkMsgSender.h>
#include <List.h>
#include <String.h>
#include <PortLink.h>
@ -1915,8 +1917,17 @@ ServerBitmap *ServerApp::FindBitmap(int32 token)
return NULL;
}
team_id ServerApp::ClientTeamID()
team_id
ServerApp::ClientTeamID() const
{
return fClientTeamID;
}
thread_id
ServerApp::MonitorThreadID() const
{
return fMonitorThreadID;
}

View File

@ -30,32 +30,30 @@
#include <OS.h>
#include <String.h>
#include <LinkMsgReader.h>
#include <LinkMsgSender.h>
#include "FMWList.h"
class AppServer;
class AreaPool;
class BMessage;
class BPortLink;
class BList;
class DisplayDriver;
class LinkMsgReader;
class LinkMsgSender;
class ServerCursor;
class ServerBitmap;
class AreaPool;
/*!
\class ServerApp ServerApp.h
\brief Counterpart to BApplication within the app_server
*/
class ServerApp
{
class ServerApp {
public:
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
team_id clientTeamID, int32 handlerID, char *signature);
virtual ~ServerApp(void);
bool Run(void);
static int32 MonitorApp(void *data);
void Lock(void);
void Unlock(void);
bool IsLocked(void);
@ -75,16 +73,20 @@ public:
void SetAppCursor(void);
ServerBitmap *FindBitmap(int32 token);
team_id ClientTeamID();
team_id ClientTeamID() const;
thread_id MonitorThreadID() const;
FMWList fAppFMWList;
const char * Title() const { return fSignature.String(); }
const char *Title() const { return fSignature.String(); }
private:
friend class AppServer;
friend class ServerWindow;
void DispatchMessage(int32 code, LinkMsgReader &link);
static int32 MonitorApp(void *data);
port_id fClientAppPort,
fMessagePort,
// TODO: find out why there is both the app port and the looper port. Do