diff --git a/src/system/kernel/messaging/MessagingService.cpp b/src/system/kernel/messaging/MessagingService.cpp index f2f2f923c0..c0dc43ac21 100644 --- a/src/system/kernel/messaging/MessagingService.cpp +++ b/src/system/kernel/messaging/MessagingService.cpp @@ -138,6 +138,14 @@ MessagingArea::Size() const } +// Empty +bool +MessagingArea::IsEmpty() const +{ + return fHeader->command_count == 0; +} + + // AllocateCommand void * MessagingArea::AllocateCommand(uint32 commandWhat, int32 dataSize, @@ -445,7 +453,7 @@ MessagingService::_AllocateCommand(int32 commandWhat, int32 size, while (fFirstArea != fLastArea) { area = fFirstArea; area->Lock(); - if (area->Size() != 0) { + if (!area->IsEmpty()) { area->Unlock(); break; } diff --git a/src/system/kernel/messaging/MessagingService.h b/src/system/kernel/messaging/MessagingService.h index 97705d8a18..0e913bc764 100644 --- a/src/system/kernel/messaging/MessagingService.h +++ b/src/system/kernel/messaging/MessagingService.h @@ -30,6 +30,7 @@ public: area_id ID() const; int32 Size() const; + bool IsEmpty() const; void *AllocateCommand(uint32 commandWhat, int32 dataSize, bool &wasEmpty); void CommitCommand();