mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
Revert "LibPthread: Partially implement pthread_cleanup_(push pop)"
This reverts commit 5d51e26caf
.
The threadlocal Vector was somehow misaligned, causing UBSAN to be sad
about calling a misaligned method (either the dtor or .is_empty()) on
it.
For now, let's revert this and avoid the CI flake.
Fixes #12957.
This commit is contained in:
parent
8ed07c8434
commit
7eafa58af8
1 changed files with 4 additions and 15 deletions
|
@ -9,7 +9,6 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/Vector.h>
|
|
||||||
#include <Kernel/API/Syscall.h>
|
#include <Kernel/API/Syscall.h>
|
||||||
#include <LibSystem/syscall.h>
|
#include <LibSystem/syscall.h>
|
||||||
#include <bits/pthread_integration.h>
|
#include <bits/pthread_integration.h>
|
||||||
|
@ -38,12 +37,6 @@ static constexpr size_t highest_reasonable_stack_size = 8 * MiB; // That's the d
|
||||||
__thread void* s_stack_location;
|
__thread void* s_stack_location;
|
||||||
__thread size_t s_stack_size;
|
__thread size_t s_stack_size;
|
||||||
|
|
||||||
struct CleanupHandler {
|
|
||||||
void (*function)(void*) { nullptr };
|
|
||||||
void* argument { nullptr };
|
|
||||||
};
|
|
||||||
thread_local Vector<CleanupHandler> s_cleanup_handlers {};
|
|
||||||
|
|
||||||
#define __RETURN_PTHREAD_ERROR(rc) \
|
#define __RETURN_PTHREAD_ERROR(rc) \
|
||||||
return ((rc) < 0 ? -(rc) : 0)
|
return ((rc) < 0 ? -(rc) : 0)
|
||||||
|
|
||||||
|
@ -146,23 +139,19 @@ int pthread_create(pthread_t* thread, pthread_attr_t* attributes, void* (*start_
|
||||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_exit.html
|
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_exit.html
|
||||||
void pthread_exit(void* value_ptr)
|
void pthread_exit(void* value_ptr)
|
||||||
{
|
{
|
||||||
while (!s_cleanup_handlers.is_empty())
|
|
||||||
pthread_cleanup_pop(1);
|
|
||||||
exit_thread(value_ptr, s_stack_location, s_stack_size);
|
exit_thread(value_ptr, s_stack_location, s_stack_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cleanup_push.html
|
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cleanup_push.html
|
||||||
void pthread_cleanup_push(void (*routine)(void*), void* arg)
|
void pthread_cleanup_push([[maybe_unused]] void (*routine)(void*), [[maybe_unused]] void* arg)
|
||||||
{
|
{
|
||||||
s_cleanup_handlers.empend(routine, arg);
|
TODO();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cleanup_pop.html
|
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_cleanup_pop.html
|
||||||
void pthread_cleanup_pop(int execute)
|
void pthread_cleanup_pop([[maybe_unused]] int execute)
|
||||||
{
|
{
|
||||||
auto entry = s_cleanup_handlers.take_last();
|
TODO();
|
||||||
if (execute != 0)
|
|
||||||
entry.function(entry.argument);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html
|
// https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue