aboutsummaryrefslogtreecommitdiff
path: root/operating-system-experiment/ParallelCalculationDemo.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-06-12 23:20:15 +0800
committercrupest <crupest@outlook.com>2021-06-12 23:25:49 +0800
commit7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531 (patch)
treef698e7730919bd6c7a0ea441ed66de971d11db97 /operating-system-experiment/ParallelCalculationDemo.cpp
parent0c1d400a5f3a93a245e579bbfa7aa251077eff26 (diff)
downloadlife-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.tar.gz
life-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.tar.bz2
life-7f2f87f3f1cc00bd16d1d5552cc126e9aabc3531.zip
...
Diffstat (limited to 'operating-system-experiment/ParallelCalculationDemo.cpp')
-rw-r--r--operating-system-experiment/ParallelCalculationDemo.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/operating-system-experiment/ParallelCalculationDemo.cpp b/operating-system-experiment/ParallelCalculationDemo.cpp
index 7340da8..0174c55 100644
--- a/operating-system-experiment/ParallelCalculationDemo.cpp
+++ b/operating-system-experiment/ParallelCalculationDemo.cpp
@@ -12,9 +12,11 @@ int main(int argc, char **argv) {
thread_number = std::atoi(argv[1]);
if (thread_number <= 0) {
std::cerr << "Argument must be a positive integer.\n";
+ return -1;
}
} else {
std::cerr << "Too many arguments.\n";
+ return -1;
}
std::cout << "Use " << thread_number << " threads to calculate sum of 1-" << N