mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Revert "LibCore: Add thread-safe weak deferred_invoke()"
This reverts commit 96ce468b60.
Appears to have regressed WPT.
This commit is contained in:
Notes:
github-actions[bot]
2026-02-06 11:07:38 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/9ad9c653688
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <AK/BinaryHeap.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <AK/Time.h>
|
||||
@@ -31,7 +30,6 @@ struct ThreadData;
|
||||
class TimeoutSet;
|
||||
|
||||
HashMap<pthread_t, ThreadData*> s_thread_data;
|
||||
HashTable<ThreadData*> s_thread_data_by_ptr;
|
||||
Threading::RWLock s_thread_data_lock;
|
||||
thread_local pthread_t s_thread_id;
|
||||
thread_local OwnPtr<ThreadData> s_this_thread_data;
|
||||
@@ -234,7 +232,6 @@ struct ThreadData {
|
||||
|
||||
Threading::RWLockLocker<Threading::LockMode::Write> locker(s_thread_data_lock);
|
||||
s_thread_data.set(s_thread_id, s_this_thread_data.ptr());
|
||||
s_thread_data_by_ptr.set(s_this_thread_data.ptr());
|
||||
} else {
|
||||
data = s_this_thread_data.ptr();
|
||||
}
|
||||
@@ -247,17 +244,6 @@ struct ThreadData {
|
||||
return s_thread_data.get(thread_id).value_or(nullptr);
|
||||
}
|
||||
|
||||
static ThreadData* for_handle(EventLoopThreadHandle handle)
|
||||
{
|
||||
if (handle == 0)
|
||||
return nullptr;
|
||||
auto* ptr = reinterpret_cast<ThreadData*>(handle);
|
||||
Threading::RWLockLocker<Threading::LockMode::Read> locker(s_thread_data_lock);
|
||||
if (!s_thread_data_by_ptr.contains(ptr))
|
||||
return nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
ThreadData()
|
||||
{
|
||||
pid = getpid();
|
||||
@@ -279,7 +265,6 @@ struct ThreadData {
|
||||
{
|
||||
Threading::RWLockLocker<Threading::LockMode::Write> locker(s_thread_data_lock);
|
||||
s_thread_data.remove(s_thread_id);
|
||||
s_thread_data_by_ptr.remove(this);
|
||||
}
|
||||
|
||||
Threading::Mutex mutex;
|
||||
@@ -691,20 +676,6 @@ void EventLoopManagerUnix::did_post_event()
|
||||
{
|
||||
}
|
||||
|
||||
EventLoopThreadHandle EventLoopManagerUnix::current_thread_handle()
|
||||
{
|
||||
return reinterpret_cast<EventLoopThreadHandle>(&ThreadData::the());
|
||||
}
|
||||
|
||||
void EventLoopManagerUnix::wake_thread(EventLoopThreadHandle handle)
|
||||
{
|
||||
auto* thread_data = ThreadData::for_handle(handle);
|
||||
if (!thread_data)
|
||||
return;
|
||||
int wake_event = 0;
|
||||
(void)Core::System::write(thread_data->wake_pipe_fds[1], { &wake_event, sizeof(wake_event) });
|
||||
}
|
||||
|
||||
EventLoopManagerUnix::~EventLoopManagerUnix() = default;
|
||||
|
||||
NonnullOwnPtr<EventLoopImplementation> EventLoopManagerUnix::make_implementation()
|
||||
|
||||
Reference in New Issue
Block a user