logo
  • 教程列表
  • SO官方文檔
  • 多執行緒
    • C11 執行緒簡單的例子
  1. StackOverflow 文件
  2. C Language 教程
  3. 多執行緒
  4. C11 執行緒簡單的例子

C11 執行緒簡單的例子

Created: November-22, 2018

#include <threads.h>
#include <stdio.h>

int run(void *arg)
{
    printf("Hello world of C11 threads.");

    return 0;
}

int main(int argc, const char *argv[])
{
    thrd_t thread;
    int result;

    thrd_create(&thread, run, NULL);

    thrd_join(&thread, &result);

    printf("Thread return %d at the end\n", result);
}
  • 多執行緒

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明