mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-30 23:12:13 +02:00
add basic tests for os::Event/SystemEvent functionality
This commit is contained in:
parent
d7a9c7ec4c
commit
5131256383
@ -146,6 +146,10 @@ hos_stratosphere_api.o: CXXFLAGS += -fno-lto
|
|||||||
init_operator_new.o: CXXFLAGS += -fno-lto
|
init_operator_new.o: CXXFLAGS += -fno-lto
|
||||||
init_libnx_shim.os.horizon.o: CXXFLAGS += -fno-lto
|
init_libnx_shim.os.horizon.o: CXXFLAGS += -fno-lto
|
||||||
|
|
||||||
|
ifeq ($(ATMOSPHERE_OS_NAME),windows)
|
||||||
|
os_%.o: CXXFLAGS += -fno-lto
|
||||||
|
endif
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
%_bin.h %.bin.o : %.bin
|
%_bin.h %.bin.o : %.bin
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
|
@ -543,7 +543,7 @@ namespace ams::fs::impl {
|
|||||||
|
|
||||||
bool IsEnabledFileSystemAccessorAccessLog(const char *mount_name) {
|
bool IsEnabledFileSystemAccessorAccessLog(const char *mount_name) {
|
||||||
/* Get the accessor. */
|
/* Get the accessor. */
|
||||||
impl::FileSystemAccessor *accessor;
|
impl::FileSystemAccessor *accessor = nullptr;
|
||||||
if (R_FAILED(impl::Find(std::addressof(accessor), mount_name))) {
|
if (R_FAILED(impl::Find(std::addressof(accessor), mount_name))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -553,7 +553,7 @@ namespace ams::fs::impl {
|
|||||||
|
|
||||||
void EnableFileSystemAccessorAccessLog(const char *mount_name) {
|
void EnableFileSystemAccessorAccessLog(const char *mount_name) {
|
||||||
/* Get the accessor. */
|
/* Get the accessor. */
|
||||||
impl::FileSystemAccessor *accessor;
|
impl::FileSystemAccessor *accessor = nullptr;
|
||||||
AMS_FS_R_ABORT_UNLESS(impl::Find(std::addressof(accessor), mount_name));
|
AMS_FS_R_ABORT_UNLESS(impl::Find(std::addressof(accessor), mount_name));
|
||||||
accessor->SetAccessLogEnabled(true);
|
accessor->SetAccessLogEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,11 @@ namespace ams::os::impl {
|
|||||||
res = ::ppoll(std::addressof(pfd), 1, ns >= 0 ? std::addressof(ts) : nullptr, nullptr);
|
res = ::ppoll(std::addressof(pfd), 1, ns >= 0 ? std::addressof(ts) : nullptr, nullptr);
|
||||||
} while (res < 0 && errno == EINTR);
|
} while (res < 0 && errno == EINTR);
|
||||||
|
|
||||||
AMS_ASSERT(res == 0);
|
AMS_ASSERT(res == 0 || res == 1);
|
||||||
return pfd.revents & POLLIN;
|
|
||||||
|
const bool signaled = pfd.revents & POLLIN;
|
||||||
|
AMS_ASSERT(signaled == (res == 1));
|
||||||
|
return signaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,11 @@ namespace ams::os::impl {
|
|||||||
res = ::poll(std::addressof(pfd), 1, timeout);
|
res = ::poll(std::addressof(pfd), 1, timeout);
|
||||||
} while (res < 0 && errno == EINTR);
|
} while (res < 0 && errno == EINTR);
|
||||||
|
|
||||||
AMS_ASSERT(res == 0);
|
AMS_ASSERT(res == 0 || res == 1);
|
||||||
return pfd.revents & POLLIN;
|
|
||||||
|
const bool signaled = pfd.revents & POLLIN;
|
||||||
|
AMS_ASSERT(signaled == (res == 1));
|
||||||
|
return signaled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ namespace ams::os::impl {
|
|||||||
const auto res = pthread_cond_timedwait(std::addressof(m_pthread_cond), std::addressof(cs->Get()->m_pthread_mutex), std::addressof(ts));
|
const auto res = pthread_cond_timedwait(std::addressof(m_pthread_cond), std::addressof(cs->Get()->m_pthread_mutex), std::addressof(ts));
|
||||||
|
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
AMS_ABORT_UNLESS(errno == ETIMEDOUT);
|
AMS_ABORT_UNLESS(res == ETIMEDOUT);
|
||||||
return ConditionVariableStatus::TimedOut;
|
return ConditionVariableStatus::TimedOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,4 +93,9 @@ namespace ams::os::impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MultiWaitLinuxImpl::ReplyAndReceiveImpl(s32 *out_index, s32 num, NativeHandle arr[], s32 array_size, s64 ns, NativeHandle reply_target) {
|
||||||
|
AMS_UNUSED(out_index, num, arr, array_size, ns, reply_target);
|
||||||
|
R_ABORT_UNLESS(os::ResultNotImplemented());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -97,4 +97,9 @@ namespace ams::os::impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MultiWaitMacosImpl::ReplyAndReceiveImpl(s32 *out_index, s32 num, NativeHandle arr[], s32 array_size, s64 ns, NativeHandle reply_target) {
|
||||||
|
AMS_UNUSED(out_index, num, arr, array_size, ns, reply_target);
|
||||||
|
R_ABORT_UNLESS(os::ResultNotImplemented());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ namespace ams::os::impl {
|
|||||||
|
|
||||||
ALWAYS_INLINE Tick GetTick() const {
|
ALWAYS_INLINE Tick GetTick() const {
|
||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
::QueryPerformanceFrequency(std::addressof(freq));
|
::QueryPerformanceCounter(std::addressof(freq));
|
||||||
return Tick(static_cast<s64>(freq.QuadPart));
|
return Tick(static_cast<s64>(freq.QuadPart));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace ams::os::impl {
|
|||||||
LARGE_INTEGER freq;
|
LARGE_INTEGER freq;
|
||||||
|
|
||||||
PerformOrderingForGetSystemTickOrdered();
|
PerformOrderingForGetSystemTickOrdered();
|
||||||
::QueryPerformanceFrequency(std::addressof(freq));
|
::QueryPerformanceCounter(std::addressof(freq));
|
||||||
PerformOrderingForGetSystemTickOrdered();
|
PerformOrderingForGetSystemTickOrdered();
|
||||||
|
|
||||||
return Tick(static_cast<s64>(freq.QuadPart));
|
return Tick(static_cast<s64>(freq.QuadPart));
|
||||||
|
Loading…
Reference in New Issue
Block a user