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)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ get_next_encoder(int32* cookie, const media_file_format* fileFormat,
|
|||||||
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
|
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
|
||||||
&candidateCodecInfo, &candidateFormatFamily, &candidateInputFormat,
|
&candidateCodecInfo, &candidateFormatFamily, &candidateInputFormat,
|
||||||
&candidateOutputFormat, *cookie);
|
&candidateOutputFormat, *cookie);
|
||||||
|
|
||||||
if (ret != B_OK)
|
if (ret != B_OK)
|
||||||
return ret;
|
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)
|
_media_format_description::operator=(const _media_format_description& other)
|
||||||
{
|
{
|
||||||
memcpy(this, &other, sizeof(*this));
|
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,
|
meta_format::Matches(const media_format& otherFormat,
|
||||||
media_format_family family)
|
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)
|
meta_format::CompareDescriptions(const meta_format* a, const meta_format* b)
|
||||||
{
|
{
|
||||||
if (a->description == b->description)
|
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)
|
meta_format::Compare(const meta_format* a, const meta_format* b)
|
||||||
{
|
{
|
||||||
int compare = CompareDescriptions(a, b);
|
int compare = CompareDescriptions(a, b);
|
||||||
@@ -422,7 +422,7 @@ update_media_formats()
|
|||||||
|
|
||||||
BMediaFormats::BMediaFormats()
|
BMediaFormats::BMediaFormats()
|
||||||
:
|
:
|
||||||
fIteratorIndex(0)
|
fIteratorIndex(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,14 +432,14 @@ BMediaFormats::~BMediaFormats()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::InitCheck()
|
BMediaFormats::InitCheck()
|
||||||
{
|
{
|
||||||
return sLock.Sem() >= B_OK ? B_OK : sLock.Sem();
|
return sLock.InitCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetCodeFor(const media_format& format,
|
BMediaFormats::GetCodeFor(const media_format& format,
|
||||||
media_format_family family,
|
media_format_family family,
|
||||||
media_format_description* _description)
|
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,
|
BMediaFormats::GetFormatFor(const media_format_description& description,
|
||||||
media_format* _format)
|
media_format* _format)
|
||||||
{
|
{
|
||||||
@@ -499,8 +499,8 @@ BMediaFormats::GetFormatFor(const media_format_description& description,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetBeOSFormatFor(uint32 format,
|
BMediaFormats::GetBeOSFormatFor(uint32 format,
|
||||||
media_format* _format, media_type type)
|
media_format* _format, media_type type)
|
||||||
{
|
{
|
||||||
BMediaFormats formats;
|
BMediaFormats formats;
|
||||||
@@ -520,7 +520,7 @@ BMediaFormats::GetBeOSFormatFor(uint32 format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetAVIFormatFor(uint32 codec,
|
BMediaFormats::GetAVIFormatFor(uint32 codec,
|
||||||
media_format* _format, media_type type)
|
media_format* _format, media_type type)
|
||||||
{
|
{
|
||||||
@@ -542,8 +542,8 @@ BMediaFormats::GetAVIFormatFor(uint32 codec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
||||||
media_format* _format, media_type type)
|
media_format* _format, media_type type)
|
||||||
{
|
{
|
||||||
BMediaFormats formats;
|
BMediaFormats formats;
|
||||||
@@ -564,7 +564,7 @@ BMediaFormats::GetQuicktimeFormatFor(uint32 vendor, uint32 codec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::RewindFormats()
|
BMediaFormats::RewindFormats()
|
||||||
{
|
{
|
||||||
if (!sLock.IsLocked() || sLock.LockingThread() != find_thread(NULL)) {
|
if (!sLock.IsLocked() || sLock.LockingThread() != find_thread(NULL)) {
|
||||||
@@ -577,7 +577,7 @@ BMediaFormats::RewindFormats()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::GetNextFormat(media_format* _format,
|
BMediaFormats::GetNextFormat(media_format* _format,
|
||||||
media_format_description* _description)
|
media_format_description* _description)
|
||||||
{
|
{
|
||||||
@@ -609,14 +609,14 @@ BMediaFormats::Lock()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMediaFormats::Unlock()
|
BMediaFormats::Unlock()
|
||||||
{
|
{
|
||||||
sLock.Unlock();
|
sLock.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
||||||
int32 descriptionCount, media_format* format, uint32 flags,
|
int32 descriptionCount, media_format* format, uint32 flags,
|
||||||
void* _reserved)
|
void* _reserved)
|
||||||
@@ -631,7 +631,7 @@ BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
|||||||
// #pragma mark - deprecated API
|
// #pragma mark - deprecated API
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BMediaFormats::MakeFormatFor(const media_format_description& description,
|
BMediaFormats::MakeFormatFor(const media_format_description& description,
|
||||||
const media_format& inFormat, media_format* _outFormat)
|
const media_format& inFormat, media_format* _outFormat)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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