libbe.so: Avoid static BLockers.

They don't work properly after a fork, and if exit() is called
from the forked child, the parent won't be able to use them
anymore.

In BBitmap and BPicture, replace them with mutexes. For AppServerLink,
make the private ServerLink inherit from BLocker, and then use
that one directly.

This also is a slight efficiency gain, as we don't need to create
multiple semaphores from the static initializers now, which is
just a waste of time in the case of applications that don't
even need these locks but link to libbe.so (e.g. CLI tools.)

Part of #18576.
This commit is contained in:
Augustin Cavalier
2026-02-26 17:15:53 -05:00
parent b43289d544
commit 9cada02ee0
6 changed files with 20 additions and 31 deletions
+4 -1
View File
@@ -12,13 +12,16 @@
#include <OS.h>
#include <Locker.h>
#include <LinkReceiver.h>
#include <LinkSender.h>
class BShape;
class BString;
class BGradient;
/*
* Error checking rules: (for if you don't want to check every return code)
* - Calling EndMessage() is optional, implied by Flush() or StartMessage().
@@ -31,7 +34,7 @@ class BGradient;
namespace BPrivate {
class ServerLink {
class ServerLink : public BLocker {
public:
ServerLink();
virtual ~ServerLink();