Easy-to-understand simple gameplay

Source: Internet
Author: User

#include <iostream> #include <thread> #include <windows.h> #include <vector>using  Namespace std;using namespace std::this_thread;void msg () { MessageBox (0,L "thread Start", L "32" , 0);} VOID&NBSP;MSGA (int num)  //threading 2222{ std::cout<<get_id ()  <<  "num="   << num << endl;} Void main ()   //thread play 2222{ vector<thread *>threads; for  (int i  = 0;i < 10;i++)  {  threads.push_back (New thread (MsgA,5));//Create Thread   Address exists vector } for  (auto th : threads)//created in execution  {  th->join ();  } cin.get ();}   int main1445 ()//thread play 111   //renamed { auto n = thread::hardware _concurrency (); cout <<  "you  cpu is "  << n < < endl; //stick to CPU core  cout << "you  cpu thread "  << get_id ()  << endl;//get thread id // Create Thread    thread threadl (msg);   thread thread2 (msg);   threadl.join () ;    //execution     must wait for execution    thread2.join ();  //Execution   getchar ( );  return 0;}

650) this.width=650; "title=" Thread. PNG "style=" Float:none; "src=" Http://s3.51cto.com/wyfs02/M02/8B/08/wKiom1hCPNvyOAkHAAB2VeHMzv8873.png-wh_ 500x0-wm_3-wmp_4-s_4043957692.png "alt=" Wkiom1hcpnvyoakhaab2vehmzv8873.png-wh_50 "/>

650) this.width=650; "Title=" thread2. PNG "style=" Float:none; "src=" Http://s3.51cto.com/wyfs02/M02/8B/04/wKioL1hCPNuTnL4iAACrKcR2uio623.png-wh_ 500x0-wm_3-wmp_4-s_3499992297.png "alt=" Wkiol1hcpnutnl4iaacrkcr2uio623.png-wh_50 "/>


This article is from the "12148490" blog, please be sure to keep this source http://12158490.blog.51cto.com/12148490/1879080

Easy-to-understand simple gameplay

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.