[haiku-commits] haiku: hrev51699 - src/system/kernel

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 20 Dec 2017 02:52:07 +0100 (CET)

hrev51699 adds 1 changeset to branch 'master'
old head: d483b4d0b5c77c78ec03a3fc2caffb354940f581
new head: 4ecdf1e195452fa410065d0016adb70d47c5a9e9
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=4ecdf1e19545+%5Ed483b4d0b5c7

----------------------------------------------------------------------------

4ecdf1e19545: team: Only lock while actually setting io_context, not while 
creating it.
  
  Thanks Ingo for the review!

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev51699
Commit:      4ecdf1e195452fa410065d0016adb70d47c5a9e9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4ecdf1e19545
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Wed Dec 20 01:51:01 2017 UTC

----------------------------------------------------------------------------

1 file changed, 6 insertions(+), 3 deletions(-)
src/system/kernel/team.cpp | 9 ++++++---

----------------------------------------------------------------------------

diff --git a/src/system/kernel/team.cpp b/src/system/kernel/team.cpp
index 6579222..1848d96 100644
--- a/src/system/kernel/team.cpp
+++ b/src/system/kernel/team.cpp
@@ -1681,7 +1681,7 @@ load_image_internal(char**& _flatArgs, size_t 
flatArgsSize, int32 argCount,
        status_t status;
        struct team_arg* teamArgs;
        struct team_loading_info loadingInfo;
-       io_context* parentIOContext = NULL;
+       io_context* parentIOContext = NULL, *ourIOContext = NULL;
        team_id teamID;
 
        if (flatArgs == NULL || argCount == 0)
@@ -1770,8 +1770,9 @@ load_image_internal(char**& _flatArgs, size_t 
flatArgsSize, int32 argCount,
                // args are owned by the team_arg structure now
 
        // create a new io_context for this team
+       ourIOContext = vfs_new_io_context(parentIOContext, true);
        team->Lock();
-       team->io_context = vfs_new_io_context(parentIOContext, true);
+       team->io_context = ourIOContext;
        team->Unlock();
        if (!team->io_context) {
                status = B_NO_MEMORY;
@@ -2037,6 +2038,7 @@ fork_team(void)
        thread_id threadID;
        status_t status;
        ssize_t areaCookie;
+       io_context* ourIOContext = NULL;
 
        TRACE(("fork_team(): team %" B_PRId32 "\n", parentTeam->id));
 
@@ -2107,8 +2109,9 @@ fork_team(void)
        }
 
        // create a new io_context for this team
+       ourIOContext = vfs_new_io_context(parentTeam->io_context, false);
        team->Lock();
-       team->io_context = vfs_new_io_context(parentTeam->io_context, false);
+       team->io_context = ourIOContext;
        team->Unlock();
        if (!team->io_context) {
                status = B_NO_MEMORY;


Other related posts: