Nobodys perfect

This commit is contained in:
plutoo 2017-10-07 23:18:21 +02:00
parent 74b14f4c63
commit b82ad0b099
2 changed files with 28 additions and 35 deletions

View File

@ -13,12 +13,12 @@ void mutexLock(Mutex* m) {
u32 self = _GetTag(); u32 self = _GetTag();
u32 cur = __sync_val_compare_and_swap(&m->Tag, 0, self); u32 cur = __sync_val_compare_and_swap(&m->Tag, 0, self);
while (1) {
if (cur == 0) { if (cur == 0) {
// We won the race! // We won the race!
return; return;
} }
while (1) {
if ((cur &~ HAS_LISTENERS) == self) { if ((cur &~ HAS_LISTENERS) == self) {
// Kernel assigned it to us! // Kernel assigned it to us!
return; return;
@ -39,11 +39,6 @@ void mutexLock(Mutex* m) {
} }
cur = __sync_val_compare_and_swap(&m->Tag, 0, self); cur = __sync_val_compare_and_swap(&m->Tag, 0, self);
if (cur == 0) {
// We won the race!
return;
}
} }
} }

View File

@ -6,7 +6,6 @@ static Handle g_fsHandle = -1;
Result fsInitialize() { Result fsInitialize() {
Result rc = smGetService(&g_fsHandle, "fsp-srv"); Result rc = smGetService(&g_fsHandle, "fsp-srv");
if (R_SUCCEEDED(rc)) {
if (R_SUCCEEDED(rc)) { if (R_SUCCEEDED(rc)) {
IpcCommand c; IpcCommand c;
ipcInitialize(&c); ipcInitialize(&c);
@ -38,7 +37,6 @@ Result fsInitialize() {
rc = resp->result; rc = resp->result;
} }
} }
}
return rc; return rc;
} }