AppServerLink: Switch to a recursive lock.

It seems in some applications (though not most of the ones I
initially tested) this can get used recursively, so we need
a recursive_lock in order to not deadlock.

Also commit a missed change from the previous commit.
This commit is contained in:
Augustin Cavalier
2026-02-27 09:22:21 -05:00
parent fb543b61ba
commit 9b5a7d7612
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -12,7 +12,6 @@
#include <OS.h> #include <OS.h>
#include <Locker.h>
#include <LinkReceiver.h> #include <LinkReceiver.h>
#include <LinkSender.h> #include <LinkSender.h>
@@ -34,7 +33,7 @@ class BGradient;
namespace BPrivate { namespace BPrivate {
class ServerLink : public BLocker { class ServerLink {
public: public:
ServerLink(); ServerLink();
virtual ~ServerLink(); virtual ~ServerLink();
+3 -3
View File
@@ -24,14 +24,14 @@
*/ */
static mutex sLock = MUTEX_INITIALIZER("AppServerLink_sLock"); static recursive_lock sLock = MUTEX_INITIALIZER("AppServerLink_sLock");
namespace BPrivate { namespace BPrivate {
AppServerLink::AppServerLink() AppServerLink::AppServerLink()
{ {
mutex_lock(&sLock); recursive_lock_lock(&sLock);
// if there is no be_app, we can't do a whole lot, anyway // if there is no be_app, we can't do a whole lot, anyway
if (be_app != NULL) { if (be_app != NULL) {
@@ -45,7 +45,7 @@ AppServerLink::AppServerLink()
AppServerLink::~AppServerLink() AppServerLink::~AppServerLink()
{ {
mutex_unlock(&sLock); recursive_lock_unlock(&sLock);
} }
} // namespace BPrivate } // namespace BPrivate