mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-30 01:01:21 +00:00
kernel: destroy untouched static rwlocks without allocation
This commit is contained in:
1 parent
97bef2992f
commit
4592e4c178
2 files changed
+16
-1
No files matched your search
@@ -101,6 +101,17 @@ void WaitForMutexTest(Predicate ready) {
|
||||
}
|
||||
}
|
||||
|
||||
void TestStaticRwlockDestroy() {
|
||||
using namespace Libs::LibKernel;
|
||||
PthreadRwlock rwlock = nullptr;
|
||||
Check(PthreadRwlockDestroy(nullptr) == KERNEL_ERROR_EINVAL &&
|
||||
PthreadRwlockDestroy(&rwlock) == OK && rwlock == nullptr,
|
||||
"destroy an untouched static rwlock without allocating it");
|
||||
Check(PthreadRwlockRdlock(&rwlock) == OK && PthreadRwlockUnlock(&rwlock) == OK &&
|
||||
PthreadRwlockDestroy(&rwlock) == OK,
|
||||
"static rwlock remains usable after destroying its untouched initializer");
|
||||
}
|
||||
|
||||
struct MutexWaiter {
|
||||
Libs::LibKernel::PthreadMutex *mutex;
|
||||
Libs::LibKernel::KernelUseconds timeout = 0;
|
||||
@@ -2723,6 +2734,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
TestMutexHandoff();
|
||||
TestStaticRwlockDestroy();
|
||||
if (argc == 2 && std::string_view(argv[1]) == "--mutex-only") {
|
||||
subsystems.Destroy();
|
||||
std::printf("KernelFileSystemTests: mutex cases passed\n");
|
||||
|
||||
Reference in new issue
Block a user