-
Notifications
You must be signed in to change notification settings - Fork 1.7k
refactor(samples): replace pthreads with std::thread in multithreaded sample #13733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Subham-KRLX
wants to merge
5
commits into
microsoft:main
Choose a base branch
from
Subham-KRLX:feature/cpp11-thread-sample
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8aeeb69
Update build.cmd
Subham-KRLX 6b7cebe
samples(Fib): remove build task, update README, remove preLaunchTask …
Subham-KRLX b111d6e
samples(Fib): include build.cmd update
Subham-KRLX 455c845
samples(Fib): fix warnings in thread.cpp (use snprintf, return) and i…
Subham-KRLX ed6d1ab
Merge branch 'main' into feature/cpp11-thread-sample
Subham-KRLX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,34 @@ | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [] | ||
| } | ||
| ```jsonc | ||
| { | ||
| "version": "2.0.0", | ||
| "tasks": [] | ||
| } | ||
| ``` | ||
| { | ||
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
| // for the documentation about the tasks.json format | ||
| "version": "2.0.0", | ||
| // The explicit "build" task was removed because the sample now uses a direct g++ command | ||
| // (the Makefile was removed). If you prefer a build task, add one that runs the | ||
| // appropriate g++ command for your platform or call `build.cmd` on Windows. | ||
| "tasks": [] | ||
| } | ||
| { | ||
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
| // for the documentation about the tasks.json format | ||
| "version": "2.0.0", | ||
| "tasks": [ | ||
| { | ||
| "label": "build", | ||
| "type": "shell", | ||
| "group": { | ||
| "kind": "build", | ||
| "isDefault": true | ||
| }, | ||
| "presentation": { | ||
| { | ||
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
| // for the documentation about the tasks.json format | ||
| "version": "2.0.0", | ||
| // The explicit "build" task was removed because the sample now uses a direct g++ command | ||
| // (the Makefile was removed). If you prefer a build task, add one that runs the | ||
| // appropriate g++ command for your platform or call `build.cmd` on Windows. | ||
| "tasks": [] | ||
| } | ||
| "echo": true, | ||
| "reveal": "always", | ||
| "focus": false, | ||
| "panel": "shared" | ||
| }, | ||
| "windows": { | ||
| "command": "${workspaceRoot}/build.cmd", | ||
| "args": [ | ||
| "<Path/To/MinGW/Cygwin/Bin/Folder>", // Path to the bin folder containing g++ to compile | ||
| "fib.exe" // Output executable name | ||
| ] | ||
| }, | ||
| "linux": { | ||
| "command": "g++", | ||
| "args": [ | ||
| "-g", | ||
| "*.cpp", | ||
| "-lpthread", | ||
| "--std=c++11", | ||
| "-o", | ||
| "fib.out" | ||
| ] | ||
| }, | ||
| "osx": { | ||
| "command": "g++", | ||
| "args": [ | ||
| "-g", | ||
| "*.cpp", | ||
| "-lpthread", | ||
| "--std=c++11", | ||
| "-o", | ||
| "fib.out" | ||
| ] | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,51 @@ | ||
| # Fib | ||
|
|
||
| This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug. | ||
|
|
||
| ## Building | ||
|
|
||
| Use one of the commands below to build the sample. The Makefile was removed and the sample is built with g++ directly. | ||
|
|
||
| ```bash | ||
| # Linux / macOS | ||
| g++ -g *.cpp -std=c++11 -o fib.out | ||
|
|
||
| # Windows (MinGW) | ||
| g++ -g *.cpp -std=c++11 -o fib.exe | ||
| ``` | ||
|
|
||
| On Windows you can also run the included `build.cmd` if you prefer (it expects the path to a MinGW/Cygwin `bin` folder and an output name): | ||
|
|
||
| ```powershell | ||
| .\build.cmd <Path\To\MinGW\Bin> fib.exe | ||
| ``` | ||
|
|
||
| After building, use the `launch.json` in this folder (or your own) to debug the produced binary. | ||
| ```markdown | ||
| # Fib | ||
|
|
||
| This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug. | ||
|
|
||
| ## Building | ||
|
|
||
| Use one of the commands below to build the sample. The Makefile was removed and the sample is built with g++ directly. | ||
|
|
||
| ```bash | ||
| # Linux / macOS | ||
| g++ -g *.cpp -std=c++11 -o fib.out | ||
|
|
||
| # Windows (MinGW) | ||
| g++ -g *.cpp -std=c++11 -o fib.exe | ||
| ``` | ||
|
|
||
| On Windows you can also run the included `build.cmd` if you prefer (it expects the path to a MinGW/Cygwin `bin` folder and an output name): | ||
|
|
||
| ```powershell | ||
| .\build.cmd <Path\To\MinGW\Bin> fib.exe | ||
| ``` | ||
|
|
||
| After building, use the `launch.json` in this folder (or your own) to debug the produced binary. | ||
| ``` | ||
| # Fib | ||
|
|
||
| This code sample is to show debugging. Update `launch.json` and `tasks.json` in the `.vscode` folder to use your setup to build and debug. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| SET PATH=%PATH%;%1 | ||
| g++ -g *.cpp -lpthread --std=c++11 -O0 -o %2 | ||
| @echo off | ||
| SET PATH=%PATH%;%1 | ||
| g++ -g *.cpp --std=c++11 -O0 -o %2 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.