Remove unnecessary usages of BLocker::Sem().

Most of these should have been BLocker::InitCheck() anyway.
The one that was actually using the sem (MessageLooper)
should just store the name parameter, which simplifies
things anyway.

Done as a result of a branch where I'm experimenting
with making BLocker not even create a semaphore in
"benaphore" mode.
This commit is contained in:
Augustin Cavalier
2019-07-27 18:31:58 -04:00
parent bbee879291
commit 565155afa1
7 changed files with 31 additions and 31 deletions
@@ -198,7 +198,7 @@ public:
status_t InitCheck() const
{
return (fLock.Sem() >= 0 ? B_OK : B_NO_INIT);
return fLock.InitCheck();
}
status_t GetHostAddress(const char* hostName, NetAddress* address)
+2 -2
View File
@@ -47,8 +47,8 @@ TerminalBuffer::~TerminalBuffer()
status_t
TerminalBuffer::Init(int32 width, int32 height, int32 historySize)
{
if (Sem() < 0)
return Sem();
if (BLocker::InitCheck() < 0)
return BLocker::InitCheck();
fAlternateScreen = _AllocateLines(width, height);
if (fAlternateScreen == NULL)
+1 -1
View File
@@ -435,7 +435,7 @@ BMediaFormats::~BMediaFormats()
status_t
BMediaFormats::InitCheck()
{
return sLock.Sem() >= B_OK ? B_OK : sLock.Sem();
return sLock.InitCheck();
}
+3 -4
View File
@@ -18,6 +18,7 @@
MessageLooper::MessageLooper(const char* name)
:
BLocker(name),
fName(name),
fThread(-1),
fQuitting(false),
fDeathSemaphore(-1)
@@ -120,10 +121,8 @@ MessageLooper::_PrepareQuit()
void
MessageLooper::_GetLooperName(char* name, size_t length)
{
sem_id semaphore = Sem();
sem_info info;
if (get_sem_info(semaphore, &info) == B_OK)
strlcpy(name, info.name, length);
if (fName != NULL)
strlcpy(name, fName, length);
else
strlcpy(name, "unnamed looper", length);
}
+1
View File
@@ -46,6 +46,7 @@ protected:
static int32 _message_thread(void*_looper);
protected:
const char* fName;
thread_id fThread;
BPrivate::PortLink fLink;
bool fQuitting;
+2 -2
View File
@@ -223,8 +223,8 @@ ServerApp::InitCheck()
if (fClientReplyPort < B_OK)
return fClientReplyPort;
if (fWindowListLock.Sem() < B_OK)
return fWindowListLock.Sem();
if (fWindowListLock.InitCheck() < B_OK)
return fWindowListLock.InitCheck();
if (fMemoryAllocator == NULL)
return B_NO_MEMORY;
+2 -2
View File
@@ -1232,8 +1232,8 @@ status_t
TRoster::Init()
{
// check lock initialization
if (fLock.Sem() < 0)
return fLock.Sem();
if (fLock.InitCheck() < 0)
return fLock.InitCheck();
// create the info
RosterAppInfo* info = new(nothrow) RosterAppInfo;