[haiku-commits] r41298 - haiku/branches/developer/bonefish/signals/src/system/kernel

Author: bonefish
Date: 2011-05-02 00:40:24 +0200 (Mon, 02 May 2011)
New Revision: 41298
Changeset: https://dev.haiku-os.org/changeset/41298

Modified:
   haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp
Log:
Moved delete_owned_ports() and sem_delete_owned_sems() from team_delete_team()
to the Team destructor. This prevents a race condition with
set_{sem,port}_owner().


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:38:39 UTC (rev 41297)
+++ haiku/branches/developer/bonefish/signals/src/system/kernel/team.cpp        
2011-05-01 22:40:24 UTC (rev 41298)
@@ -604,6 +604,9 @@
        // get rid of all associated data
        PrepareForDeletion();
 
+       delete_owned_ports(this);
+       sem_delete_owned_sems(this);
+
        while (::death_entry* threadDeathEntry
                        = (::death_entry*)list_remove_head_item(&dead_threads)) 
{
                free(threadDeathEntry);
@@ -652,7 +655,7 @@
 
 /*!    \brief Returns the team with the given ID.
        Returns a reference to the team.
-       Team and thread spinlock must not be hold.
+       Team and thread spinlock must not be held.
 */
 /*static*/ Team*
 Team::Get(team_id id)
@@ -2726,8 +2729,6 @@
        vfs_put_io_context(team->io_context);
        delete_realtime_sem_context(team->realtime_sem_context);
        xsi_sem_undo(team);
-       delete_owned_ports(team);
-       sem_delete_owned_sems(team);
        remove_images(team);
        team->address_space->RemoveAndPut();
 


Other related posts:

  • » [haiku-commits] r41298 - haiku/branches/developer/bonefish/signals/src/system/kernel - ingo_weinhold