IOSchedulerRoster:

* Lock the notification service and check HasListeners(), so we don't prepare
  an event message needlessly.
* The on-stack buffer for the event message was too small for I/O operation
  related events. Now a larger buffer belonging to the roster object is used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34737 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-12-21 21:00:21 +00:00
parent 1fde952c1d
commit 1c12dcb598
2 changed files with 8 additions and 3 deletions

View File

@ -910,9 +910,13 @@ void
IOSchedulerRoster::Notify(uint32 eventCode, const IOScheduler* scheduler,
IORequest* request, IOOperation* operation)
{
char eventBuffer[128];
AutoLocker<DefaultNotificationService> locker(fNotificationService);
if (!fNotificationService.HasListeners())
return;
KMessage event;
event.SetTo(eventBuffer, sizeof(eventBuffer), IO_SCHEDULER_MONITOR);
event.SetTo(fEventBuffer, sizeof(fEventBuffer), IO_SCHEDULER_MONITOR);
event.AddInt32("event", eventCode);
event.AddPointer("scheduler", scheduler);
if (request != NULL) {
@ -921,7 +925,7 @@ IOSchedulerRoster::Notify(uint32 eventCode, const IOScheduler* scheduler,
event.AddPointer("operation", operation);
}
fNotificationService.Notify(event, eventCode);
fNotificationService.NotifyLocked(event, eventCode);
}

View File

@ -182,6 +182,7 @@ private:
int32 fNextID;
IOSchedulerList fSchedulers;
DefaultNotificationService fNotificationService;
char fEventBuffer[256];
static IOSchedulerRoster sDefaultInstance;
};