mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
fssystem: add unique lock apis
This commit is contained in:
parent
28f11a86fd
commit
2e6223d9d0
2 changed files with 112 additions and 3 deletions
|
@ -158,6 +158,18 @@ namespace ams::fssystem {
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result TryAcquireCountSemaphore(util::unique_lock<SemaphoreAdaptor> *out, SemaphoreAdaptor *adaptor) {
|
||||
/* Create deferred unique lock. */
|
||||
util::unique_lock<SemaphoreAdaptor> lock(*adaptor, std::defer_lock);
|
||||
|
||||
/* Try to lock. */
|
||||
R_UNLESS(lock.try_lock(), fs::ResultOpenCountLimit());
|
||||
|
||||
/* Set the output lock. */
|
||||
*out = std::move(lock);
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void AddCounter(void *_counter, size_t counter_size, u64 value) {
|
||||
u8 *counter = static_cast<u8 *>(_counter);
|
||||
u64 remaining = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue