BMediaFormats::InitCheck() now checks if the global lock could be initialized

to give its existance a bit more sense.
update_media_formats() no longer ASSERTS if the lock is held, but fails
if it's not locked.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6300 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-01-25 15:56:10 +00:00
parent ddb013472a
commit 0f18208594
+3 -2
View File
@@ -261,7 +261,8 @@ meta_format::Compare(const meta_format *a, const meta_format *b)
static status_t static status_t
update_media_formats() update_media_formats()
{ {
ASSERT(sLock.IsLocked()); if (!sLock.IsLocked())
return B_NOT_ALLOWED;
BMessage request(MEDIA_SERVER_GET_FORMATS); BMessage request(MEDIA_SERVER_GET_FORMATS);
request.AddInt64("last_timestamp", sLastFormatsUpdate); request.AddInt64("last_timestamp", sLastFormatsUpdate);
@@ -337,7 +338,7 @@ BMediaFormats::~BMediaFormats()
status_t status_t
BMediaFormats::InitCheck() BMediaFormats::InitCheck()
{ {
return B_OK; return sLock.Sem() >= B_OK ? B_OK : sLock.Sem();
} }