Author: bonefish Date: 2011-05-02 01:11:10 +0200 (Mon, 02 May 2011) New Revision: 41299 Changeset: https://dev.haiku-os.org/changeset/41299 Modified: haiku/branches/developer/bonefish/signals/src/system/kernel/debug/system_profiler.cpp haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp Log: team_iterate_through_teams() no longer requires the caller to hold the teams spinlock. Adjusted the only user, SystemProfiler::Init(), accordingly. Modified: haiku/branches/developer/bonefish/signals/src/system/kernel/debug/system_profiler.cpp =================================================================== --- haiku/branches/developer/bonefish/signals/src/system/kernel/debug/system_profiler.cpp 2011-05-01 22:40:24 UTC (rev 41298) +++ haiku/branches/developer/bonefish/signals/src/system/kernel/debug/system_profiler.cpp 2011-05-01 23:11:10 UTC (rev 41299) @@ -446,11 +446,8 @@ // teams if ((fFlags & B_SYSTEM_PROFILER_TEAM_EVENTS) != 0) { - InterruptsSpinLocker teamsLocker(gTeamSpinlock); if (team_iterate_through_teams(&_InitialTeamIterator, this) != NULL) return B_BUFFER_OVERFLOW; - fTeamNotificationsEnabled = true; - teamsLocker.Unlock(); } // images @@ -1240,6 +1237,8 @@ SystemProfiler::_InitialTeamIterator(Team* team, void* cookie) { SystemProfiler* self = (SystemProfiler*)cookie; + self->fTeamNotificationsEnabled = true; + // Set that here, since the team lock is being held now. return !self->_TeamAdded(team); } Modified: haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp =================================================================== --- haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp 2011-05-01 22:40:24 UTC (rev 41298) +++ haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp 2011-05-01 23:11:10 UTC (rev 41299) @@ -2326,11 +2326,13 @@ } -/*! Iterates through the list of teams. The team spinlock must be held. +/*! Iterates through the list of teams. The team spinlock must not be held. */ Team* team_iterate_through_teams(team_iterator_callback callback, void* cookie) { + InterruptsSpinLocker teamsLocker(gTeamSpinlock); + for (TeamTable::Iterator it = sTeamHash.GetIterator(); Team* team = it.Next();) { if (callback(team, cookie))