Skip to content

Commit

Permalink
[cpp] thread1-learning
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoujingfighting committed Sep 3, 2023
1 parent 62946fc commit 52e57a8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 语言相关/cpp基础入门/multi-thread.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
#include <thread>
#include <pthread.h>

void function1(char symbol) {
for (int i = 0; i < 200; i++) {
std::cout << symbol;
}
std::cout << std::endl;
}

void function2() {
for (int i = 0; i < 200; i++) {
std::cout << "-";
}
std::cout << std::endl;
}

int main() {
std::thread work1(function1, 'o');
std::thread work2(function2);
system("parse>nul");
}

0 comments on commit 52e57a8

Please sign in to comment.