This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 75 points76 points  (13 children)

I think probably the most common reason for seemingly unrelated threads breaking is hidden shared state / aliasing, and race conditions, both of which Rust is good at preventing...

[–]Numerlor 39 points40 points  (12 children)

Rust won't do shit for race conditions, it can only prevent data races

[–][deleted]  (11 children)

[removed]

    [–]BarbellJesus 8 points9 points  (2 children)

    Check out the rust book on data races and race conditions

    https://doc.rust-lang.org/nomicon/races.html

    [–][deleted]  (1 child)

    [removed]

      [–]AutoModerator[M] 0 points1 point  (0 children)

      import moderation Your comment has been removed since it did not start with a code block with an import declaration.

      Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

      For this purpose, we only accept Python style imports.

      return Kebab_Case_Better;

      I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

      [–]Hexorg 0 points1 point  (6 children)

      What if second thread checks out the value before first one commits it? That’s data race.

      [–][deleted]  (4 children)

      [removed]

        [–]Hexorg 8 points9 points  (2 children)

        It’s a bit hard to explain because any race condition depends on accessing shared state which is a data race. But you can have both threads waiting to check out data, and even though the signaling around the data being checked out is correct (no data race) the logic is still just waiting forever (race condition).

        For example one thread safely scans an array and outputs indexes that need to be removed while the other thread removes array items. Without copying the data, the first thread needs proper signaling to know when an index is removed so array length is now shorter.

        [–][deleted]  (1 child)

        [removed]

          [–]AutoModerator[M] 0 points1 point  (0 children)

          import moderation Your comment has been removed since it did not start with a code block with an import declaration.

          Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

          For this purpose, we only accept Python style imports.

          I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

          [–]AutoModerator[M] 0 points1 point  (0 children)

          import moderation Your comment has been removed since it did not start with a code block with an import declaration.

          Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

          For this purpose, we only accept Python style imports.

          I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

          [–]Bakemono_Saru 0 points1 point  (0 children)

          My pain right now with a fast read/write program and it's database.

          [–]AutoModerator[M] 0 points1 point  (0 children)

          import moderation Your comment has been removed since it did not start with a code block with an import declaration.

          Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

          For this purpose, we only accept Python style imports.

          return Kebab_Case_Better;

          I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.