mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
19 lines
428 B
C
19 lines
428 B
C
// Copyright 2018 plutoo
|
|
#include "types.h"
|
|
#include "result.h"
|
|
#include "kernel/svc.h"
|
|
#include "kernel/condvar.h"
|
|
#include "../internal.h"
|
|
|
|
Result condvarWaitTimeout(CondVar* c, Mutex* m, u64 timeout) {
|
|
Result rc;
|
|
|
|
rc = svcWaitProcessWideKeyAtomic((u32*)m, c, getThreadVars()->handle, timeout);
|
|
|
|
// On timeout, we need to acquire it manually.
|
|
if (R_VALUE(rc) == 0xEA01)
|
|
mutexLock(m);
|
|
|
|
return rc;
|
|
}
|