1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

LibThreading: Rename Lock => Mutex

This commit is contained in:
Andreas Kling 2021-07-09 11:14:57 +02:00
parent ce5d2b4f16
commit b8a204c5b9
8 changed files with 37 additions and 37 deletions

View file

@ -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) {