zoukankan      html  css  js  c++  java
  • _beginthreadex

    //创建多子个线程实例  

    #include <stdio.h>  

    #include <process.h>  

    #include <windows.h>  

    //子线程函数  

    unsigned int __stdcall ThreadFun(PVOID pM)  

    {  

        printf("线程ID号为%4d的子线程说:Hello World ", GetCurrentThreadId());  

     return 0;  

    }  

    //主函数,所谓主函数其实就是主线程执行的函数。  

    int main()  

    {  

        printf("     创建多个子线程实例  ");  

        printf(" -- by MoreWindows( http://blog.csdn.net/MoreWindows ) -- ");  

        const int THREAD_NUM = 5;  

        HANDLE handle[THREAD_NUM];  

        for (int i = 0; i < THREAD_NUM; i++)  

            handle[i] = (HANDLE)_beginthreadex(NULL, 0, ThreadFun, NULL, 0, NULL);  

        WaitForMultipleObjects(THREAD_NUM, handle, TRUE, INFINITE);  

        return 0;  

    }  

  • 相关阅读:
    webpack
    react 原理
    jest
    input 自动获取焦点
    taro
    html5标签
    webpack
    每日日报
    每日日报
    每日日报
  • 原文地址:https://www.cnblogs.com/waterair/p/7049869.html
Copyright © 2011-2022 走看看