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:
@@ -93,7 +93,7 @@ AppServer::AppServer(void) :
|
|||||||
fCursorSem(-1),
|
fCursorSem(-1),
|
||||||
fCursorArea(-1)
|
fCursorArea(-1)
|
||||||
{
|
{
|
||||||
fMessagePort= create_port(200, SERVER_PORT_NAME);
|
fMessagePort = create_port(200, SERVER_PORT_NAME);
|
||||||
if (fMessagePort == B_NO_MORE_PORTS)
|
if (fMessagePort == B_NO_MORE_PORTS)
|
||||||
debugger("app_server could not create message port");
|
debugger("app_server could not create message port");
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
|||||||
|
|
||||||
BPortLink replylink(app_port);
|
BPortLink replylink(app_port);
|
||||||
replylink.StartMessage(SERVER_TRUE);
|
replylink.StartMessage(SERVER_TRUE);
|
||||||
replylink.Attach<int32>(newapp->fMessagePort);
|
replylink.Attach<int32>(server_listen);
|
||||||
replylink.Flush();
|
replylink.Flush();
|
||||||
|
|
||||||
// This is necessary because BPortLink::ReadString allocates memory
|
// This is necessary because BPortLink::ReadString allocates memory
|
||||||
@@ -603,7 +603,7 @@ void AppServer::DispatchMessage(int32 code, BPortLink &msg)
|
|||||||
{
|
{
|
||||||
srvapp=(ServerApp *)fAppList->ItemAt(i);
|
srvapp=(ServerApp *)fAppList->ItemAt(i);
|
||||||
|
|
||||||
if(srvapp != NULL && srvapp->fMonitorThreadID== srvapp_id)
|
if(srvapp != NULL && srvapp->MonitorThreadID() == srvapp_id)
|
||||||
{
|
{
|
||||||
srvapp=(ServerApp *)fAppList->RemoveItem(i);
|
srvapp=(ServerApp *)fAppList->RemoveItem(i);
|
||||||
if(srvapp)
|
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
|
// 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
|
// or hung. Seeing that being the case, we'll kill its BApp team and fake the
|
||||||
// quit message
|
// quit message
|
||||||
if(get_thread_info(app->fMonitorThreadID, &tinfo)==B_OK)
|
if(get_thread_info(app->MonitorThreadID(), &tinfo)==B_OK)
|
||||||
{
|
{
|
||||||
bool killteam=true;
|
bool killteam=true;
|
||||||
|
|
||||||
for(int32 j=0; j<5; j++)
|
for(int32 j=0; j<5; j++)
|
||||||
{
|
{
|
||||||
snooze(500000); // wait half a second for it to quit
|
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;
|
killteam=false;
|
||||||
break;
|
break;
|
||||||
@@ -856,7 +856,7 @@ ServerApp *AppServer::FindApp(const char *sig)
|
|||||||
for(int32 i=0; i<fAppList->CountItems();i++)
|
for(int32 i=0; i<fAppList->CountItems();i++)
|
||||||
{
|
{
|
||||||
foundapp=(ServerApp*)fAppList->ItemAt(i);
|
foundapp=(ServerApp*)fAppList->ItemAt(i);
|
||||||
if(foundapp && foundapp->fSignature==sig)
|
if(foundapp && foundapp->Title() == sig)
|
||||||
{
|
{
|
||||||
release_sem(fAppListLock);
|
release_sem(fAppListLock);
|
||||||
return foundapp;
|
return foundapp;
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
//
|
//
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include <AppDefs.h>
|
#include <AppDefs.h>
|
||||||
|
#include <LinkMsgReader.h>
|
||||||
|
#include <LinkMsgSender.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <PortLink.h>
|
#include <PortLink.h>
|
||||||
@@ -1915,8 +1917,17 @@ ServerBitmap *ServerApp::FindBitmap(int32 token)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
team_id ServerApp::ClientTeamID()
|
|
||||||
|
team_id
|
||||||
|
ServerApp::ClientTeamID() const
|
||||||
{
|
{
|
||||||
return fClientTeamID;
|
return fClientTeamID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
thread_id
|
||||||
|
ServerApp::MonitorThreadID() const
|
||||||
|
{
|
||||||
|
return fMonitorThreadID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-10
@@ -30,32 +30,30 @@
|
|||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <LinkMsgReader.h>
|
|
||||||
#include <LinkMsgSender.h>
|
|
||||||
#include "FMWList.h"
|
#include "FMWList.h"
|
||||||
|
|
||||||
class AppServer;
|
class AreaPool;
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class BPortLink;
|
class BPortLink;
|
||||||
class BList;
|
class BList;
|
||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
|
class LinkMsgReader;
|
||||||
|
class LinkMsgSender;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
class AreaPool;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ServerApp ServerApp.h
|
\class ServerApp ServerApp.h
|
||||||
\brief Counterpart to BApplication within the app_server
|
\brief Counterpart to BApplication within the app_server
|
||||||
*/
|
*/
|
||||||
class ServerApp
|
class ServerApp {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
ServerApp(port_id sendport, port_id rcvport, port_id clientLooperPort,
|
||||||
team_id clientTeamID, int32 handlerID, char *signature);
|
team_id clientTeamID, int32 handlerID, char *signature);
|
||||||
virtual ~ServerApp(void);
|
virtual ~ServerApp(void);
|
||||||
|
|
||||||
bool Run(void);
|
bool Run(void);
|
||||||
static int32 MonitorApp(void *data);
|
|
||||||
void Lock(void);
|
void Lock(void);
|
||||||
void Unlock(void);
|
void Unlock(void);
|
||||||
bool IsLocked(void);
|
bool IsLocked(void);
|
||||||
@@ -75,16 +73,20 @@ public:
|
|||||||
void SetAppCursor(void);
|
void SetAppCursor(void);
|
||||||
ServerBitmap *FindBitmap(int32 token);
|
ServerBitmap *FindBitmap(int32 token);
|
||||||
|
|
||||||
team_id ClientTeamID();
|
team_id ClientTeamID() const;
|
||||||
|
thread_id MonitorThreadID() const;
|
||||||
|
|
||||||
FMWList fAppFMWList;
|
FMWList fAppFMWList;
|
||||||
const char * Title() const { return fSignature.String(); }
|
|
||||||
|
const char *Title() const { return fSignature.String(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class AppServer;
|
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
|
|
||||||
void DispatchMessage(int32 code, LinkMsgReader &link);
|
void DispatchMessage(int32 code, LinkMsgReader &link);
|
||||||
|
|
||||||
|
static int32 MonitorApp(void *data);
|
||||||
|
|
||||||
port_id fClientAppPort,
|
port_id fClientAppPort,
|
||||||
fMessagePort,
|
fMessagePort,
|
||||||
// TODO: find out why there is both the app port and the looper port. Do
|
// TODO: find out why there is both the app port and the looper port. Do
|
||||||
|
|||||||
Reference in New Issue
Block a user