Skip to content

Commit

Permalink
Merge pull request #9 from Gliniak/object_table_rewrite
Browse files Browse the repository at this point in the history
[Kernel] Rewrite of: ObjectTable
  • Loading branch information
backgamon authored Feb 1, 2025
2 parents 4cc074d + 656b80a commit f04447f
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 242 deletions.
30 changes: 30 additions & 0 deletions src/xenia/base/spinlock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2024 Xenia Canary. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/

#ifndef XENIA_BASE_SPINLOCK_H_
#define XENIA_BASE_SPINLOCK_H_

#include <atomic>

namespace xe {
class spinlock {
public:
void lock() {
while (locked.test_and_set(std::memory_order_acquire)) {
;
}
}
void unlock() { locked.clear(std::memory_order_release); }

private:
std::atomic_flag locked = ATOMIC_FLAG_INIT;
};

} // namespace xe
#endif
2 changes: 1 addition & 1 deletion src/xenia/kernel/kernel_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ void KernelState::UnloadUserModule(const object_ref<UserModule>& module,
return e->path() == module->path();
}) == user_modules_.end());

object_table()->ReleaseHandleInLock(module->handle());
object_table()->ReleaseHandle(module->handle());
}

void KernelState::TerminateTitle() {
Expand Down
Loading

0 comments on commit f04447f

Please sign in to comment.