|
ReXGlue SDK
|
Public Member Functions | |
| MutantObject (bool initial_owner, u32 guest_mutant_in=0) | |
| X_STATUS | Release (bool abandon, i32 *previous_state=nullptr) |
| bool | OnAcquired (const rex::platform::WaitHandle *waited) |
| void | Adopt (MutantObject &fresh) |
Public Attributes | |
| PublishedPtr< rex::platform::Mutant > | mutant |
| std::atomic< u32 > | owner_thread_id {0} |
| std::atomic< i32 > | hold_count {0} |
| std::atomic< bool > | abandoned {false} |
| u32 | guest_mutant = 0 |
| std::mutex | state_mutex |
|
explicit |
| initial_owner | True when the creating thread owns the mutant at once. |
| guest_mutant_in | The guest KMUTANT the object backs, 0 for none. |
| void rex::kernel::MutantObject::Adopt | ( | MutantObject & | fresh | ) |
Replaces the host mutant and the owner state with those of a new object.
| fresh | A mutant no other thread can see, whose host mutant is taken. |
| bool rex::kernel::MutantObject::OnAcquired | ( | const rex::platform::WaitHandle * | waited | ) |
Sets the current thread as the owner after a successful wait.
| waited | The host mutant the wait returned on. A replaced mutant leaves the owner as it is. |
| X_STATUS rex::kernel::MutantObject::Release | ( | bool | abandon, |
| i32 * | previous_state = nullptr ) |
Releases a mutant held by the current thread.
| abandon | True to release every hold and mark the mutant abandoned. |
| previous_state | Receives the signal state before the release, may be null. |
| std::atomic<bool> rex::kernel::MutantObject::abandoned {false} |
Set by an abandon, cleared by the next acquire.
| u32 rex::kernel::MutantObject::guest_mutant = 0 |
The guest KMUTANT the object backs, 0 for none.
| std::atomic<i32> rex::kernel::MutantObject::hold_count {0} |
Number of recursive acquires by the owner, 0 when unowned.
| PublishedPtr<rex::platform::Mutant> rex::kernel::MutantObject::mutant |
Host mutant that waiters block on.
| std::atomic<u32> rex::kernel::MutantObject::owner_thread_id {0} |
ID of the owning thread, 0 when no thread owns the mutant.
| std::mutex rex::kernel::MutantObject::state_mutex |
Orders Release, OnAcquired and Adopt, so a replaced host mutant never changes the owner.