Skip to content

Conversation

@JadeCara
Copy link
Owner

This pull request includes changes to set up a new Rust project for handling data races, including configuration files, a Makefile, and a main Rust source file. The most important changes are the addition of the Cargo.toml file, the Makefile, and the implementation of a simple multithreaded program using a mutex.

Project setup:

  • module2/data_race/Cargo.toml: Added the package configuration for the new Rust project, specifying the package name, version, edition, and dependencies.

Build and management:

  • module2/data_race/Makefile: Added a Makefile with targets for common development tasks such as building, running, testing, linting, formatting, and releasing the project. It also includes a target for bumping the project version.

Multithreading implementation:

  • module2/data_race/src/main.rs: Implemented a simple program that demonstrates the use of a mutex to protect shared data across multiple threads. The program spawns three threads, each modifying an element of a vector, and includes a commented-out section explaining why a similar approach without a mutex would fail to compile due to the borrow checker.

@JadeCara JadeCara merged commit 22754c3 into main Dec 5, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants