summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Assistant/main.cpp12
-rw-r--r--Userland/DevTools/HackStudio/Debugger/Debugger.h2
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp2
-rw-r--r--Userland/Libraries/LibC/malloc.cpp18
-rw-r--r--Userland/Libraries/LibCore/EventLoop.cpp12
-rw-r--r--Userland/Libraries/LibThreading/BackgroundAction.cpp2
-rw-r--r--Userland/Libraries/LibThreading/Mutex.h (renamed from Userland/Libraries/LibThreading/Lock.h)24
-rw-r--r--Userland/Services/AudioServer/Mixer.h2
8 files changed, 37 insertions, 37 deletions
diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp
index 24f16aef43..3655a4adc1 100644
--- a/Userland/Applications/Assistant/main.cpp
+++ b/Userland/Applications/Assistant/main.cpp
@@ -16,7 +16,7 @@
#include <LibGUI/Painter.h>
#include <LibGUI/TextBox.h>
#include <LibGfx/Palette.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <unistd.h>
namespace Assistant {
@@ -26,7 +26,7 @@ struct AppState {
NonnullRefPtrVector<Result> results;
size_t visible_result_count { 0 };
- Threading::Lock lock;
+ Threading::Mutex lock;
String last_query;
};
@@ -143,7 +143,7 @@ private:
void did_receive_results(String const& query, NonnullRefPtrVector<Result> const& results)
{
{
- Threading::Locker db_locker(m_lock);
+ Threading::MutexLocker db_locker(m_mutex);
auto it = m_result_cache.find(query);
if (it == m_result_cache.end()) {
m_result_cache.set(query, {});
@@ -160,7 +160,7 @@ private:
}
}
- Threading::Locker state_locker(m_state.lock);
+ Threading::MutexLocker state_locker(m_state.lock);
auto new_results = m_result_cache.find(m_state.last_query);
if (new_results == m_result_cache.end())
return;
@@ -181,7 +181,7 @@ private:
NonnullOwnPtrVector<Provider> m_providers;
- Threading::Lock m_lock;
+ Threading::Mutex m_mutex;
HashMap<String, NonnullRefPtrVector<Result>> m_result_cache;
};
@@ -223,7 +223,7 @@ int main(int argc, char** argv)
text_box.on_change = [&]() {
{
- Threading::Locker locker(app_state.lock);
+ Threading::MutexLocker locker(app_state.lock);
if (app_state.last_query == text_box.text())
return;
diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.h b/Userland/DevTools/HackStudio/Debugger/Debugger.h
index f485c5c4f5..98d84b9137 100644
--- a/Userland/DevTools/HackStudio/Debugger/Debugger.h
+++ b/Userland/DevTools/HackStudio/Debugger/Debugger.h
@@ -11,7 +11,7 @@
#include <AK/LexicalPath.h>
#include <AK/Vector.h>
#include <LibDebug/DebugSession.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <LibThreading/Thread.h>
namespace HackStudio {
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 060fe1db22..2b0916a786 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -62,7 +62,7 @@
#include <LibGUI/Window.h>
#include <LibGfx/FontDatabase.h>
#include <LibGfx/Palette.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <LibThreading/Thread.h>
#include <LibVT/TerminalWidget.h>
#include <fcntl.h>
diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp
index 11ce3ae812..5c1f88b433 100644
--- a/Userland/Libraries/LibC/malloc.cpp
+++ b/Userland/Libraries/LibC/malloc.cpp
@@ -8,7 +8,7 @@
#include <AK/ScopedValueRollback.h>
#include <AK/Vector.h>
#include <LibELF/AuxiliaryVector.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <assert.h>
#include <errno.h>
#include <mallocdefs.h>
@@ -24,10 +24,10 @@
#define RECYCLE_BIG_ALLOCATIONS
-static Threading::Lock& malloc_lock()
+static Threading::Mutex& malloc_lock()
{
- alignas(Threading::Lock) static u8 lock_storage[sizeof(Threading::Lock)];
- return *reinterpret_cast<Threading::Lock*>(lock_storage);
+ alignas(Threading::Mutex) static u8 lock_storage[sizeof(Threading::Mutex)];
+ return *reinterpret_cast<Threading::Mutex*>(lock_storage);
}
constexpr size_t number_of_hot_chunked_blocks_to_keep_around = 16;
@@ -167,7 +167,7 @@ enum class CallerWillInitializeMemory {
static void* malloc_impl(size_t size, CallerWillInitializeMemory caller_will_initialize_memory)
{
- Threading::Locker locker(malloc_lock());
+ Threading::MutexLocker locker(malloc_lock());
if (s_log_malloc)
dbgln("LibC: malloc({})", size);
@@ -304,7 +304,7 @@ static void free_impl(void* ptr)
g_malloc_stats.number_of_free_calls++;
- Threading::Locker locker(malloc_lock());
+ Threading::MutexLocker locker(malloc_lock());
void* block_base = (void*)((FlatPtr)ptr & ChunkedBlock::ChunkedBlock::block_mask);
size_t magic = *(size_t*)block_base;
@@ -413,7 +413,7 @@ size_t malloc_size(void* ptr)
{
if (!ptr)
return 0;
- Threading::Locker locker(malloc_lock());
+ Threading::MutexLocker locker(malloc_lock());
void* page_base = (void*)((FlatPtr)ptr & ChunkedBlock::block_mask);
auto* header = (const CommonHeader*)page_base;
auto size = header->m_size;
@@ -440,7 +440,7 @@ void* realloc(void* ptr, size_t size)
return nullptr;
}
- Threading::Locker locker(malloc_lock());
+ Threading::MutexLocker locker(malloc_lock());
auto existing_allocation_size = malloc_size(ptr);
if (size <= existing_allocation_size) {
@@ -457,7 +457,7 @@ void* realloc(void* ptr, size_t size)
void __malloc_init()
{
- new (&malloc_lock()) Threading::Lock();
+ new (&malloc_lock()) Threading::Mutex();
s_in_userspace_emulator = (int)syscall(SC_emuctl, 0) != -ENOSYS;
if (s_in_userspace_emulator) {
diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp
index 87e04188e8..be8406279e 100644
--- a/Userland/Libraries/LibCore/EventLoop.cpp
+++ b/Userland/Libraries/LibCore/EventLoop.cpp
@@ -21,7 +21,7 @@
#include <LibCore/LocalSocket.h>
#include <LibCore/Notifier.h>
#include <LibCore/Object.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@@ -54,7 +54,7 @@ struct EventLoopTimer {
};
struct EventLoop::Private {
- Threading::Lock lock;
+ Threading::Mutex lock;
};
static EventLoop* s_main_event_loop;
@@ -370,7 +370,7 @@ void EventLoop::pump(WaitMode mode)
decltype(m_queued_events) events;
{
- Threading::Locker locker(m_private->lock);
+ Threading::MutexLocker locker(m_private->lock);
events = move(m_queued_events);
}
@@ -399,7 +399,7 @@ void EventLoop::pump(WaitMode mode)
}
if (m_exit_requested) {
- Threading::Locker locker(m_private->lock);
+ Threading::MutexLocker 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());
@@ -414,7 +414,7 @@ void EventLoop::pump(WaitMode mode)
void EventLoop::post_event(Object& receiver, NonnullOwnPtr<Event>&& event)
{
- Threading::Locker lock(m_private->lock);
+ Threading::MutexLocker 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));
}
@@ -598,7 +598,7 @@ retry:
bool queued_events_is_empty;
{
- Threading::Locker locker(m_private->lock);
+ Threading::MutexLocker locker(m_private->lock);
queued_events_is_empty = m_queued_events.is_empty();
}
diff --git a/Userland/Libraries/LibThreading/BackgroundAction.cpp b/Userland/Libraries/LibThreading/BackgroundAction.cpp
index 0eb49b755b..0f7330c855 100644
--- a/Userland/Libraries/LibThreading/BackgroundAction.cpp
+++ b/Userland/Libraries/LibThreading/BackgroundAction.cpp
@@ -7,7 +7,7 @@
#include <AK/Queue.h>
#include <LibThreading/BackgroundAction.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <LibThreading/Thread.h>
#include <unistd.h>
diff --git a/Userland/Libraries/LibThreading/Lock.h b/Userland/Libraries/LibThreading/Mutex.h
index a2c26ce09d..77700b1cf1 100644
--- a/Userland/Libraries/LibThreading/Lock.h
+++ b/Userland/Libraries/LibThreading/Mutex.h
@@ -12,9 +12,9 @@
namespace Threading {
-class Lock {
+class Mutex {
public:
- Lock()
+ Mutex()
{
#ifndef __serenity__
pthread_mutexattr_t attr;
@@ -23,7 +23,7 @@ public:
pthread_mutex_init(&m_mutex, &attr);
#endif
}
- ~Lock() { }
+ ~Mutex() { }
void lock();
void unlock();
@@ -36,27 +36,27 @@ private:
#endif
};
-class Locker {
+class MutexLocker {
public:
- ALWAYS_INLINE explicit Locker(Lock& l)
- : m_lock(l)
+ ALWAYS_INLINE explicit MutexLocker(Mutex& mutex)
+ : m_mutex(mutex)
{
lock();
}
- ALWAYS_INLINE ~Locker() { unlock(); }
- ALWAYS_INLINE void unlock() { m_lock.unlock(); }
- ALWAYS_INLINE void lock() { m_lock.lock(); }
+ ALWAYS_INLINE ~MutexLocker() { unlock(); }
+ ALWAYS_INLINE void unlock() { m_mutex.unlock(); }
+ ALWAYS_INLINE void lock() { m_mutex.lock(); }
private:
- Lock& m_lock;
+ Mutex& m_mutex;
};
-ALWAYS_INLINE void Lock::lock()
+ALWAYS_INLINE void Mutex::lock()
{
pthread_mutex_lock(&m_mutex);
}
-inline void Lock::unlock()
+ALWAYS_INLINE void Mutex::unlock()
{
pthread_mutex_unlock(&m_mutex);
}
diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h
index c5a6fde437..74ff92ee2a 100644
--- a/Userland/Services/AudioServer/Mixer.h
+++ b/Userland/Services/AudioServer/Mixer.h
@@ -16,7 +16,7 @@
#include <AK/WeakPtr.h>
#include <LibAudio/Buffer.h>
#include <LibCore/File.h>
-#include <LibThreading/Lock.h>
+#include <LibThreading/Mutex.h>
#include <LibThreading/Thread.h>
namespace AudioServer {