-2
マルチスレッドは初めてです。ここに私が欲しいものがありますC++ multithreading:条件変数
thread_function(){
// do job1;
//wait main thread to notify;
// do job2;
}
main(){
//create two threads
//wait both threads to finish job1
//finish job3, then let both threads start job2
//wait both threads to join
}
どうすればいいですか?ありがとう。ここで
は私のコードは、私の質問は、私は一つの機能にJOB1とJOB2を組み合わせ、および順序を制御するために、条件変数を使用できるかどうかである
void job1(){
}
void job2(){
}
void job3(){
}
int main(){
thread t11(job1);
thread t12(job1);
t11.join();
t12.join();
job3();
thread t21(job2);
thread t22(job2);
t21.join();
t22.join();
}
のですか? 「Q」の下
最も良い方法は、一束を研究してから、いくつかのコードを書くことです。あなたの個人的なコード作成サービスではありません。 –
あなたが試したことを教えてください。 – Brian