1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibThread: Move CLock to LibThread::Lock

And adapt all the code that uses it.
This commit is contained in:
Sergey Bugaev 2019-08-25 23:51:27 +03:00 committed by Andreas Kling
parent 0826cc5a35
commit 3439a479af
7 changed files with 42 additions and 34 deletions

View file

@ -2,7 +2,7 @@
#include <AK/InlineLinkedList.h>
#include <AK/ScopedValueRollback.h>
#include <AK/Vector.h>
#include <LibCore/CLock.h>
#include <LibThread/Lock.h>
#include <assert.h>
#include <mallocdefs.h>
#include <serenity.h>
@ -19,10 +19,10 @@
#define MAGIC_BIGALLOC_HEADER 0x42697267
#define PAGE_ROUND_UP(x) ((((size_t)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
static CLock& malloc_lock()
static LibThread::Lock& malloc_lock()
{
static u32 lock_storage[sizeof(CLock) / sizeof(u32)];
return *reinterpret_cast<CLock*>(&lock_storage);
static u32 lock_storage[sizeof(LibThread::Lock) / sizeof(u32)];
return *reinterpret_cast<LibThread::Lock*>(&lock_storage);
}
static const int number_of_chunked_blocks_to_keep_around_per_size_class = 32;
@ -317,7 +317,7 @@ void* realloc(void* ptr, size_t size)
void __malloc_init()
{
new (&malloc_lock()) CLock();
new (&malloc_lock()) LibThread::Lock();
if (getenv("LIBC_NOSCRUB_MALLOC"))
s_scrub_malloc = false;
if (getenv("LIBC_NOSCRUB_FREE"))