forked from xenia-canary/xenia-canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Gliniak/object_table_rewrite
[Kernel] Rewrite of: ObjectTable
- Loading branch information
Showing
6 changed files
with
284 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.