BAN: Add more APIs for Atomic and make compare_exchage take a reference

This commit is contained in:
2024-06-28 21:47:47 +03:00
parent 0c645ba867
commit 48a76426e7
4 changed files with 41 additions and 8 deletions

View File

@@ -346,7 +346,8 @@ namespace Kernel
if (m_info.has<ConnectionInfo>())
{
auto& connection_info = m_info.get<ConnectionInfo>();
if (connection_info.target_closed.compare_exchange(true, false))
bool expected = true;
if (connection_info.target_closed.compare_exchange(expected, false))
return 0;
if (!connection_info.connection)
return BAN::Error::from_errno(ENOTCONN);