mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-22 02:45:07 -04:00
PM: Refactor for R_TRY, remove gotos
This commit is contained in:
parent
c60ee15449
commit
ee40dcd76f
15 changed files with 126 additions and 165 deletions
|
@ -13,7 +13,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <mutex>
|
||||
#include <switch.h>
|
||||
|
@ -23,27 +23,27 @@
|
|||
class ProcessWaiter final : public IWaitable {
|
||||
public:
|
||||
std::shared_ptr<Registration::Process> process;
|
||||
|
||||
|
||||
ProcessWaiter(std::shared_ptr<Registration::Process> p) : process(p) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
std::shared_ptr<Registration::Process> GetProcess() {
|
||||
return this->process;
|
||||
|
||||
std::shared_ptr<Registration::Process> GetProcess() {
|
||||
return this->process;
|
||||
}
|
||||
|
||||
/* IWaitable */
|
||||
|
||||
/* IWaitable */
|
||||
Handle GetHandle() override {
|
||||
return this->process->handle;
|
||||
}
|
||||
|
||||
|
||||
Result HandleSignaled(u64 timeout) override {
|
||||
return Registration::HandleSignaledProcess(this->GetProcess());
|
||||
}
|
||||
};
|
||||
|
||||
class ProcessList final {
|
||||
private:
|
||||
private:
|
||||
HosRecursiveMutex m;
|
||||
|
||||
HosRecursiveMutex *GetMutex() {
|
||||
|
@ -51,15 +51,15 @@ class ProcessList final {
|
|||
}
|
||||
public:
|
||||
std::vector<std::shared_ptr<Registration::Process>> processes;
|
||||
|
||||
|
||||
void lock() {
|
||||
GetMutex()->lock();
|
||||
}
|
||||
|
||||
|
||||
void unlock() {
|
||||
GetMutex()->unlock();
|
||||
}
|
||||
|
||||
|
||||
void try_lock() {
|
||||
GetMutex()->try_lock();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue