We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<thread> #include<stdlib.h> #include<time.h> #include<mutex> #include<Windows.h> #define NELL 0 using namespace std; mutex mtx; int main() { int x; Adam: void input(int* p); void output(int* k); thread in(input, &x); in.join( ); thread out(output, &x); out.join(); Sleep(1000); goto Adam; return 0; } void input(int* p) { mtx.lock(); srand(time(NELL)); *p = rand() % 100 + 1; mtx.unlock(); } void output(int* k) { mtx.lock(); if(*k%2==0) cout << *k << endl; mtx.unlock(); } [多线程处理.log](https://github.com/Adam-QLUT/cpp_mutex_homework/files/13475888/default.log)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: