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:
@@ -198,7 +198,7 @@ public:
|
|||||||
|
|
||||||
status_t InitCheck() const
|
status_t InitCheck() const
|
||||||
{
|
{
|
||||||
return (fLock.Sem() >= 0 ? B_OK : B_NO_INIT);
|
return fLock.InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t GetHostAddress(const char* hostName, NetAddress* address)
|
status_t GetHostAddress(const char* hostName, NetAddress* address)
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ TerminalBuffer::~TerminalBuffer()
|
|||||||
status_t
|
status_t
|
||||||
TerminalBuffer::Init(int32 width, int32 height, int32 historySize)
|
TerminalBuffer::Init(int32 width, int32 height, int32 historySize)
|
||||||
{
|
{
|
||||||
if (Sem() < 0)
|
if (BLocker::InitCheck() < 0)
|
||||||
return Sem();
|
return BLocker::InitCheck();
|
||||||
|
|
||||||
fAlternateScreen = _AllocateLines(width, height);
|
fAlternateScreen = _AllocateLines(width, height);
|
||||||
if (fAlternateScreen == NULL)
|
if (fAlternateScreen == NULL)
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ BMediaFormats::~BMediaFormats()
|
|||||||
status_t
|
status_t
|
||||||
BMediaFormats::InitCheck()
|
BMediaFormats::InitCheck()
|
||||||
{
|
{
|
||||||
return sLock.Sem() >= B_OK ? B_OK : sLock.Sem();
|
return sLock.InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
MessageLooper::MessageLooper(const char* name)
|
MessageLooper::MessageLooper(const char* name)
|
||||||
:
|
:
|
||||||
BLocker(name),
|
BLocker(name),
|
||||||
|
fName(name),
|
||||||
fThread(-1),
|
fThread(-1),
|
||||||
fQuitting(false),
|
fQuitting(false),
|
||||||
fDeathSemaphore(-1)
|
fDeathSemaphore(-1)
|
||||||
@@ -120,10 +121,8 @@ MessageLooper::_PrepareQuit()
|
|||||||
void
|
void
|
||||||
MessageLooper::_GetLooperName(char* name, size_t length)
|
MessageLooper::_GetLooperName(char* name, size_t length)
|
||||||
{
|
{
|
||||||
sem_id semaphore = Sem();
|
if (fName != NULL)
|
||||||
sem_info info;
|
strlcpy(name, fName, length);
|
||||||
if (get_sem_info(semaphore, &info) == B_OK)
|
|
||||||
strlcpy(name, info.name, length);
|
|
||||||
else
|
else
|
||||||
strlcpy(name, "unnamed looper", length);
|
strlcpy(name, "unnamed looper", length);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ protected:
|
|||||||
static int32 _message_thread(void*_looper);
|
static int32 _message_thread(void*_looper);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
const char* fName;
|
||||||
thread_id fThread;
|
thread_id fThread;
|
||||||
BPrivate::PortLink fLink;
|
BPrivate::PortLink fLink;
|
||||||
bool fQuitting;
|
bool fQuitting;
|
||||||
|
|||||||
@@ -223,8 +223,8 @@ ServerApp::InitCheck()
|
|||||||
if (fClientReplyPort < B_OK)
|
if (fClientReplyPort < B_OK)
|
||||||
return fClientReplyPort;
|
return fClientReplyPort;
|
||||||
|
|
||||||
if (fWindowListLock.Sem() < B_OK)
|
if (fWindowListLock.InitCheck() < B_OK)
|
||||||
return fWindowListLock.Sem();
|
return fWindowListLock.InitCheck();
|
||||||
|
|
||||||
if (fMemoryAllocator == NULL)
|
if (fMemoryAllocator == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|||||||
@@ -1232,8 +1232,8 @@ status_t
|
|||||||
TRoster::Init()
|
TRoster::Init()
|
||||||
{
|
{
|
||||||
// check lock initialization
|
// check lock initialization
|
||||||
if (fLock.Sem() < 0)
|
if (fLock.InitCheck() < 0)
|
||||||
return fLock.Sem();
|
return fLock.InitCheck();
|
||||||
|
|
||||||
// create the info
|
// create the info
|
||||||
RosterAppInfo* info = new(nothrow) RosterAppInfo;
|
RosterAppInfo* info = new(nothrow) RosterAppInfo;
|
||||||
|
|||||||
Reference in New Issue
Block a user