mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-23 03:06:52 -04:00
os: implement LightSemaphore
This commit is contained in:
parent
b8a1ebd11a
commit
1e7a327a25
7 changed files with 346 additions and 5 deletions
|
@ -15,13 +15,14 @@
|
|||
*/
|
||||
#include <stratosphere.hpp>
|
||||
#include "impl/os_waitable_object_list.hpp"
|
||||
#include "impl/os_waitable_holder_impl.hpp"
|
||||
#include "impl/os_timeout_helper.hpp"
|
||||
|
||||
namespace ams::os {
|
||||
|
||||
void InitializeSemaphore(SemaphoreType *sema, s32 count, s32 max_count) {
|
||||
AMS_ASSERT(max_count >= 1);
|
||||
AMS_ASSERT(count >= 0);
|
||||
AMS_ASSERT(0 <= count && count <= max_count);
|
||||
|
||||
/* Setup objects. */
|
||||
util::ConstructAt(sema->cs_sema);
|
||||
|
@ -141,6 +142,12 @@ namespace ams::os {
|
|||
return sema->count;
|
||||
}
|
||||
|
||||
// void InitializeWaitableHolder(WaitableHolderType *waitable_holder, SemaphoreType *sema);
|
||||
void InitializeWaitableHolder(WaitableHolderType *waitable_holder, SemaphoreType *sema) {
|
||||
AMS_ASSERT(sema->state == SemaphoreType::State_Initialized);
|
||||
|
||||
util::ConstructAt(GetReference(waitable_holder->impl_storage).holder_of_semaphore_storage, sema);
|
||||
|
||||
waitable_holder->user_data = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue