kernel/team: Minor code cleanup in LockTeamAndParent and LockTeamAndProcessGroup.

Make them look a bit more similar to each other.
No functional change intended.
This commit is contained in:
Augustin Cavalier
2024-12-26 22:52:51 -05:00
parent da880bc23d
commit 38210e8510
+3 -6
View File
@@ -649,10 +649,10 @@ Team::LockTeamAndParent(bool dontLockParentIfKernel)
while (true) { while (true) {
// If the team doesn't have a parent, we're done. Otherwise try to lock // If the team doesn't have a parent, we're done. Otherwise try to lock
// the parent.This will succeed in most cases, simplifying things. // the parent. This will succeed in most cases, simplifying things.
Team* parent = this->parent; Team* parent = this->parent;
if (parent == NULL || (dontLockParentIfKernel && parent == sKernelTeam) if (parent == NULL || (dontLockParentIfKernel && parent == sKernelTeam)
|| parent->TryLock()) { || parent->TryLock()) {
return; return;
} }
@@ -734,10 +734,7 @@ Team::LockTeamAndProcessGroup()
// Try to lock the group. This will succeed in most cases, simplifying // Try to lock the group. This will succeed in most cases, simplifying
// things. // things.
ProcessGroup* group = this->group; ProcessGroup* group = this->group;
if (group == NULL) if (group == NULL || group->TryLock())
return;
if (group->TryLock())
return; return;
// get a temporary reference to the group, unlock this team, lock the // get a temporary reference to the group, unlock this team, lock the