1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 02:38:13 +00:00

LibThread: Remove LOCKER() macro, as it adds no value

The LOCKER() macro appears to have been added to LibThread as a
userspace analog to the previous LOCKER() macro that existed in
the kernel. The kernel version used the macro to inject __FILE__ and
__LINE__ number into the lock acquisition for debugging. However
AK::SourceLocation was used to remove the need for the macro. So
the kernel version no longer exists. The LOCKER() in LibThread doesn't
appear to actually need to be a macro, using the type directly works
fine, and arguably is more readable as it removes an unnecessary
level of indirection.
This commit is contained in:
Brian Gianforcaro 2021-05-10 01:21:35 -07:00 committed by Andreas Kling
parent 0b7395848a
commit 691b6f69c5
5 changed files with 17 additions and 15 deletions

View file

@ -372,7 +372,7 @@ void EventLoop::pump(WaitMode mode)
decltype(m_queued_events) events;
{
LOCKER(m_private->lock);
LibThread::Locker locker(m_private->lock);
events = move(m_queued_events);
}
@ -401,7 +401,7 @@ void EventLoop::pump(WaitMode mode)
}
if (m_exit_requested) {
LOCKER(m_private->lock);
LibThread::Locker locker(m_private->lock);
dbgln_if(EVENTLOOP_DEBUG, "Core::EventLoop: Exit requested. Rejigging {} events.", events.size() - i);
decltype(m_queued_events) new_event_queue;
new_event_queue.ensure_capacity(m_queued_events.size() + events.size());
@ -416,7 +416,7 @@ void EventLoop::pump(WaitMode mode)
void EventLoop::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
{
LOCKER(m_private->lock);
LibThread::Locker lock(m_private->lock);
dbgln_if(EVENTLOOP_DEBUG, "Core::EventLoop::post_event: ({}) << receivier={}, event={}", m_queued_events.size(), receiver, event);
m_queued_events.empend(receiver, move(event));
}
@ -601,7 +601,7 @@ retry:
bool queued_events_is_empty;
{
LOCKER(m_private->lock);
LibThread::Locker locker(m_private->lock);
queued_events_is_empty = m_queued_events.is_empty();
}