AppServerLink: Use a mutex.

X512 pointed out that ServerLink is inherited by PortLink which is
used by all windows, so the original change had the unintended effect
of allocating another semaphore for every window, which isn't wanted.
So, just use a static mutex here also.
This commit is contained in:
Augustin Cavalier
2026-02-27 09:15:48 -05:00
parent 3f8cbb026f
commit fb543b61ba
2 changed files with 8 additions and 4 deletions
+8 -2
View File
@@ -13,6 +13,8 @@
#include <ApplicationPrivate.h>
#include <AppServerLink.h>
#include <locks.h>
/** AppServerLink provides proxied access to the application's
* connection with the app_server.
@@ -22,13 +24,17 @@
*/
static mutex sLock = MUTEX_INITIALIZER("AppServerLink_sLock");
namespace BPrivate {
AppServerLink::AppServerLink()
{
mutex_lock(&sLock);
// if there is no be_app, we can't do a whole lot, anyway
if (be_app != NULL) {
BApplication::Private::ServerLink()->Lock();
fReceiver = &BApplication::Private::ServerLink()->Receiver();
fSender = &BApplication::Private::ServerLink()->Sender();
} else {
@@ -39,7 +45,7 @@ AppServerLink::AppServerLink()
AppServerLink::~AppServerLink()
{
BApplication::Private::ServerLink()->Unlock();
mutex_unlock(&sLock);
}
} // namespace BPrivate
-2
View File
@@ -24,8 +24,6 @@ namespace BPrivate {
ServerLink::ServerLink()
:
BLocker()
{
}