1/*
2 * Copyright 2001-2005, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Erik Jaesler (erik@cgsoftware.com)
7 *		Axel Dörfler, axeld@pinc-software.de
8 */
9
10
11#include <Application.h>
12#include <Locker.h>
13
14#include <ApplicationPrivate.h>
15#include <AppServerLink.h>
16
17
18/**	AppServerLink provides proxied access to the application's
19 *	connection with the app_server.
20 *	It has BAutolock semantics:
21 *	creating one locks the app_server connection; destroying one
22 *	unlocks the connection.
23 */
24
25
26static BLocker sLock("AppServerLink_sLock");
27
28
29namespace BPrivate {
30
31AppServerLink::AppServerLink(void)
32{
33	sLock.Lock();
34
35	// if there is no be_app, we can't do a whole lot, anyway
36	if (be_app) {
37		fReceiver = &BApplication::Private::ServerLink()->Receiver();
38		fSender = &BApplication::Private::ServerLink()->Sender();
39	} else {
40		debugger("You need to have a valid app_server connection first!");
41	}
42}
43
44
45AppServerLink::~AppServerLink()
46{
47	sLock.Unlock();
48}
49
50}	// namespace BPrivate
51