mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
mlibc: temp patch while fix isn't upstream
This commit is contained in:
@@ -75,6 +75,20 @@ index 3474615..e034881 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
char **backtrace_symbols(void *const *, int) {
|
char **backtrace_symbols(void *const *, int) {
|
||||||
|
diff --git mlibc-clean/options/internal/include/mlibc/lock.hpp mlibc-workdir/options/internal/include/mlibc/lock.hpp
|
||||||
|
index aa05079..8bff987 100644
|
||||||
|
--- mlibc-clean/options/internal/include/mlibc/lock.hpp
|
||||||
|
+++ mlibc-workdir/options/internal/include/mlibc/lock.hpp
|
||||||
|
@@ -50,7 +50,8 @@ struct FutexLockImpl {
|
||||||
|
|
||||||
|
// If the wait returns EAGAIN, that means that the waitersBit was just unset by
|
||||||
|
// some other thread. In this case, we should loop back around.
|
||||||
|
- if (e && e != EAGAIN)
|
||||||
|
+ // Also loop around in case of a signal interrupting the wait
|
||||||
|
+ if (e && e != EAGAIN && e != EINTR)
|
||||||
|
mlibc::panicLogger() << "sys_futex_wait() failed with error code " << e << frg::endlog;
|
||||||
|
|
||||||
|
// Opportunistically try to take the lock after we wake up.
|
||||||
diff --git mlibc-clean/options/posix/generic/dlfcn-stubs.cpp mlibc-workdir/options/posix/generic/dlfcn-stubs.cpp
|
diff --git mlibc-clean/options/posix/generic/dlfcn-stubs.cpp mlibc-workdir/options/posix/generic/dlfcn-stubs.cpp
|
||||||
index fc34a3b..b1a95a9 100644
|
index fc34a3b..b1a95a9 100644
|
||||||
--- mlibc-clean/options/posix/generic/dlfcn-stubs.cpp
|
--- mlibc-clean/options/posix/generic/dlfcn-stubs.cpp
|
||||||
@@ -85,6 +99,22 @@ index fc34a3b..b1a95a9 100644
|
|||||||
#include <bits/ensure.h>
|
#include <bits/ensure.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
diff --git mlibc-clean/options/posix/generic/pthread-stubs.cpp mlibc-workdir/options/posix/generic/pthread-stubs.cpp
|
||||||
|
index 775989b..d28f950 100644
|
||||||
|
--- mlibc-clean/options/posix/generic/pthread-stubs.cpp
|
||||||
|
+++ mlibc-workdir/options/posix/generic/pthread-stubs.cpp
|
||||||
|
@@ -844,7 +844,10 @@ int pthread_once(pthread_once_t *once, void (*function) (void)) {
|
||||||
|
}else{
|
||||||
|
// a different thread is currently running the initializer.
|
||||||
|
__ensure(expected == onceLocked);
|
||||||
|
- if(int e = mlibc::sys_futex_wait((int *)&once->__mlibc_done, onceLocked, nullptr); e)
|
||||||
|
+ // if it gets interrupted by a signal, check again.
|
||||||
|
+ // EAGAIN will also be a retry, as it means the other thread completed
|
||||||
|
+ // and changed the __mlibc_done variable to signal it
|
||||||
|
+ if(int e = mlibc::sys_futex_wait((int *)&once->__mlibc_done, onceLocked, nullptr); e && e != EINTR && e != EAGAIN)
|
||||||
|
__ensure(!"sys_futex_wait() failed");
|
||||||
|
expected = __atomic_load_n(&once->__mlibc_done, __ATOMIC_ACQUIRE);
|
||||||
|
}
|
||||||
diff --git mlibc-clean/options/posix/generic/unistd-stubs.cpp mlibc-workdir/options/posix/generic/unistd-stubs.cpp
|
diff --git mlibc-clean/options/posix/generic/unistd-stubs.cpp mlibc-workdir/options/posix/generic/unistd-stubs.cpp
|
||||||
index 3279cc6..71837aa 100644
|
index 3279cc6..71837aa 100644
|
||||||
--- mlibc-clean/options/posix/generic/unistd-stubs.cpp
|
--- mlibc-clean/options/posix/generic/unistd-stubs.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user