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
|
||||
{
|
||||
return (fLock.Sem() >= 0 ? B_OK : B_NO_INIT);
|
||||
return fLock.InitCheck();
|
||||
}
|
||||
|
||||
status_t GetHostAddress(const char* hostName, NetAddress* address)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -100,7 +100,7 @@ get_next_encoder(int32* cookie, const media_file_format* fileFormat,
|
||||
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
|
||||
&candidateCodecInfo, &candidateFormatFamily, &candidateInputFormat,
|
||||
&candidateOutputFormat, *cookie);
|
||||
|
||||
|
||||
if (ret != B_OK)
|
||||
return ret;
|
||||
|
||||
@@ -186,7 +186,7 @@ _media_format_description::_media_format_description(
|
||||
}
|
||||
|
||||
|
||||
_media_format_description&
|
||||
_media_format_description&
|
||||
_media_format_description::operator=(const _media_format_description& other)
|
||||
{
|
||||
memcpy(this, &other, sizeof(*this));
|
||||
@@ -318,7 +318,7 @@ meta_format::meta_format(const meta_format& other)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
bool
|
||||
meta_format::Matches(const media_format& otherFormat,
|
||||
media_format_family family)
|
||||
{
|
||||
@@ -329,7 +329,7 @@ meta_format::Matches(const media_format& otherFormat,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
meta_format::CompareDescriptions(const meta_format* a, const meta_format* b)
|
||||
{
|
||||
if (a->description == b->description)
|
||||
@@ -342,7 +342,7 @@ meta_format::CompareDescriptions(const meta_format* a, const meta_format* b)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
meta_format::Compare(const meta_format* a, const meta_format* b)
|
||||
{
|
||||
int compare = CompareDescriptions(a, b);
|
||||
@@ -422,7 +422,7 @@ update_media_formats()
|
||||
|
||||
BMediaFormats::BMediaFormats()
|
||||
:
|
||||
fIteratorIndex(0)
|
||||
fIteratorIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -432,14 +432,14 @@ BMediaFormats::~BMediaFormats()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::InitCheck()
|
||||
{
|
||||
return sLock.Sem() >= B_OK ? B_OK : sLock.Sem();
|
||||
return sLock.InitCheck();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::GetCodeFor(const media_format& format,
|
||||
media_format_family family,
|
||||
media_format_description* _description)
|
||||
@@ -465,7 +465,7 @@ BMediaFormats::GetCodeFor(const media_format& format,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::GetFormatFor(const media_format_description& description,
|
||||
media_format* _format)
|
||||
{
|
||||
@@ -499,8 +499,8 @@ BMediaFormats::GetFormatFor(const media_format_description& description,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaFormats::GetBeOSFormatFor(uint32 format,
|
||||
status_t
|
||||
BMediaFormats::GetBeOSFormatFor(uint32 format,
|
||||
media_format* _format, media_type type)
|
||||
{
|
||||
BMediaFormats formats;
|
||||
@@ -520,7 +520,7 @@ BMediaFormats::GetBeOSFormatFor(uint32 format,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::GetAVIFormatFor(uint32 codec,
|
||||
media_format* _format, media_type type)
|
||||
{
|
||||
@@ -542,8 +542,8 @@ BMediaFormats::GetAVIFormatFor(uint32 codec,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
||||
status_t
|
||||
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
||||
media_format* _format, media_type type)
|
||||
{
|
||||
BMediaFormats formats;
|
||||
@@ -564,7 +564,7 @@ BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::RewindFormats()
|
||||
{
|
||||
if (!sLock.IsLocked() || sLock.LockingThread() != find_thread(NULL)) {
|
||||
@@ -577,7 +577,7 @@ BMediaFormats::RewindFormats()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::GetNextFormat(media_format* _format,
|
||||
media_format_description* _description)
|
||||
{
|
||||
@@ -609,14 +609,14 @@ BMediaFormats::Lock()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
BMediaFormats::Unlock()
|
||||
{
|
||||
sLock.Unlock();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
||||
int32 descriptionCount, media_format* format, uint32 flags,
|
||||
void* _reserved)
|
||||
@@ -631,7 +631,7 @@ BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
||||
// #pragma mark - deprecated API
|
||||
|
||||
|
||||
status_t
|
||||
status_t
|
||||
BMediaFormats::MakeFormatFor(const media_format_description& description,
|
||||
const media_format& inFormat, media_format* _outFormat)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ protected:
|
||||
static int32 _message_thread(void*_looper);
|
||||
|
||||
protected:
|
||||
const char* fName;
|
||||
thread_id fThread;
|
||||
BPrivate::PortLink fLink;
|
||||
bool fQuitting;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user