mirror of
https://review.haiku-os.org/haiku
synced 2025-01-18 12:38:51 +01:00
kernel/listeners: Use an rw_spinlock for the gWaitObjectListenerLock.
When the system profiler is in use, this spinlock is used very often. Internally there's another spinlock which isn't (yet) rw, though.
This commit is contained in:
parent
5a39b9f82f
commit
038d9b44d1
@ -80,7 +80,7 @@ struct WaitObjectListener : DoublyLinkedListLinkImpl<WaitObjectListener> {
|
||||
|
||||
typedef DoublyLinkedList<WaitObjectListener> WaitObjectListenerList;
|
||||
extern WaitObjectListenerList gWaitObjectListeners;
|
||||
extern spinlock gWaitObjectListenerLock;
|
||||
extern rw_spinlock gWaitObjectListenerLock;
|
||||
|
||||
|
||||
template<typename Parameter1>
|
||||
@ -89,7 +89,7 @@ NotifyWaitObjectListeners(void (WaitObjectListener::*hook)(Parameter1),
|
||||
Parameter1 parameter1)
|
||||
{
|
||||
if (!gWaitObjectListeners.IsEmpty()) {
|
||||
InterruptsSpinLocker locker(gWaitObjectListenerLock);
|
||||
InterruptsReadSpinLocker locker(gWaitObjectListenerLock);
|
||||
WaitObjectListenerList::Iterator it
|
||||
= gWaitObjectListeners.GetIterator();
|
||||
while (WaitObjectListener* listener = it.Next())
|
||||
@ -105,7 +105,7 @@ NotifyWaitObjectListeners(
|
||||
Parameter1 parameter1, Parameter2 parameter2)
|
||||
{
|
||||
if (!gWaitObjectListeners.IsEmpty()) {
|
||||
InterruptsSpinLocker locker(gWaitObjectListenerLock);
|
||||
InterruptsReadSpinLocker locker(gWaitObjectListenerLock);
|
||||
WaitObjectListenerList::Iterator it
|
||||
= gWaitObjectListeners.GetIterator();
|
||||
while (WaitObjectListener* listener = it.Next())
|
||||
|
@ -321,7 +321,7 @@ SystemProfiler::~SystemProfiler()
|
||||
|
||||
// stop wait object listening
|
||||
if (fWaitObjectNotificationsRequested) {
|
||||
InterruptsSpinLocker locker(gWaitObjectListenerLock);
|
||||
InterruptsWriteSpinLocker locker(gWaitObjectListenerLock);
|
||||
remove_wait_object_listener(this);
|
||||
}
|
||||
|
||||
@ -514,7 +514,7 @@ SystemProfiler::Init()
|
||||
scheduler_add_listener(this);
|
||||
fSchedulerNotificationsRequested = true;
|
||||
|
||||
InterruptsSpinLocker waitObjectLocker(gWaitObjectListenerLock);
|
||||
InterruptsWriteSpinLocker waitObjectLocker(gWaitObjectListenerLock);
|
||||
add_wait_object_listener(this);
|
||||
fWaitObjectNotificationsRequested = true;
|
||||
waitObjectLocker.Unlock();
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
|
||||
WaitObjectListenerList gWaitObjectListeners;
|
||||
spinlock gWaitObjectListenerLock = B_SPINLOCK_INITIALIZER;
|
||||
rw_spinlock gWaitObjectListenerLock = B_RW_SPINLOCK_INITIALIZER;
|
||||
|
||||
|
||||
WaitObjectListener::~WaitObjectListener()
|
||||
|
Loading…
Reference in New Issue
Block a user