mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:37:35 +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:
parent
0b7395848a
commit
691b6f69c5
5 changed files with 17 additions and 15 deletions
|
@ -17,7 +17,7 @@ static intptr_t background_thread_func()
|
|||
while (true) {
|
||||
Function<void()> work_item;
|
||||
{
|
||||
LOCKER(s_all_actions->lock());
|
||||
LibThread::Locker locker(s_all_actions->lock());
|
||||
|
||||
if (!s_all_actions->resource().is_empty())
|
||||
work_item = s_all_actions->resource().dequeue();
|
||||
|
|
|
@ -53,7 +53,7 @@ private:
|
|||
, m_action(move(action))
|
||||
, m_on_complete(move(on_complete))
|
||||
{
|
||||
LOCKER(all_actions().lock());
|
||||
Locker locker(all_actions().lock());
|
||||
|
||||
all_actions().resource().enqueue([this] {
|
||||
m_result = m_action();
|
||||
|
|
|
@ -70,8 +70,6 @@ inline void Lock::unlock()
|
|||
--m_level;
|
||||
}
|
||||
|
||||
# define LOCKER(lock) LibThread::Locker locker(lock)
|
||||
|
||||
template<typename T>
|
||||
class Lockable {
|
||||
public:
|
||||
|
@ -92,7 +90,7 @@ public:
|
|||
|
||||
T lock_and_copy()
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
Locker locker(m_lock);
|
||||
return m_resource;
|
||||
}
|
||||
|
||||
|
@ -113,8 +111,12 @@ public:
|
|||
~Lock() { }
|
||||
};
|
||||
|
||||
class Locker {
|
||||
public:
|
||||
explicit Locker(Lock&) { }
|
||||
~Locker() { }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
# define LOCKER(x)
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue