当前位置: 首页 > news >正文

店面门头设计网站番禺建设网站报价

店面门头设计网站,番禺建设网站报价,中企动力做过的网站,微信公众平台官方好的, 现在简单的写一个例子, 1、线程函数 函数int runThread(void *arg) 做为一个thread,实现简单的打印信息功能。 2、在int testSimpleThread()中, thrd_create(),创建线程。三个参数粉分别是thrd_t&#xff0c…

好的, 现在简单的写一个例子,

1、线程函数

函数int runThread(void *arg)

做为一个thread,实现简单的打印信息功能。

2、在int testSimpleThread()中,

  1. thrd_create(),创建线程。三个参数粉分别是thrd_t,线程函数,线程的参数。
  2. thrd_join(),等待进程结束。

可以直接在main()调用这个函数,做个简单的实验。

注意:本篇主要是在Windows下实现多进程的验证学习,所以GetCurrentThreadId()是Windows专属的函数,要是在Mac或者Linux下面,要注意兼容性,回头再做讨论。

#include "tinycthread.h"int runThread(void *arg)
{const char *threadName = "Thread1";const char *threadMsg = (const char *)arg;unsigned long threadId = (unsigned long)GetCurrentThreadId();printf("Thread %s(%lu): %s\n", threadName, (unsigned long)threadId, threadMsg);return 0;
}int testSimpleThread()
{thrd_t thread;const char *threadMsg = "Hello from thread!";// create a threadint result = thrd_create(&thread, runThread, (void *)threadMsg);if (result != thrd_success){printf("Failed to create thread.\n");return -1;}int threadResult;if (thrd_join(thread, &threadResult) != thrd_success){printf("Failed to join thread.\n");return -1;}printf("Thread exited with: %d\n", threadResult);return 0;
}

http://www.yayakq.cn/news/104059/

相关文章:

  • 长沙做公司网站英文网站制作++官网
  • 国际人才网中山招聘网快速整站优化
  • 做网站百科网站建设承诺
  • php 上传到网站做母婴网站设计思路
  • 外国小孩和大人做网站深圳外贸招聘
  • 查找网站开发者青海建设兵团青岛战友网站
  • 专门做摩托车的网站可视化前端开发工具
  • 做网站需要融资墨刀做网站
  • 长沙网站优化推广方案北京酷站科技有限公司
  • 网站建设属于技术服务wordpress首页只显示一篇文章
  • 上海建筑建材业门户网站代理公司注册上海
  • 昆明网站建设价目表孝感应城网站建设
  • 网站建设网上消费算在年费php做网站界面代码
  • php除了写网站吗有没有专门做衣服搭配的网站
  • 泉州建设公司网站济宁祥云网站建设
  • 网站管理主要包括哪些内容中国互联网协会投诉平台
  • 网站主页面布局怎么做电脑安装wordpress
  • 新塘网站seo优化中英文网站模板源码
  • 福建省中城建设工程有限公司网站永州做网站的公司
  • 好的网站域名网站开发用的是什么语言
  • 投资公司网站开发阿里云可以做网站吗
  • 2345浏览器官方网站动图制作网站
  • 寻花问柳一家专门做男人的网站余姚网站建设报价
  • 信息产业部网站备案查询网上超市商城
  • 网站推广公司需要多少钱怎么做有趣的微视频网站
  • 网站模版 源码东莞网站建设营销平台的
  • 大连平台网站建设以下哪个不属于网络营销的特点
  • 设计电子商务网站推荐几个用vue做的网站
  • 云主机搭建多个网站如何建设医院网站
  • 用六类网站做电话可以吗北京建站管理系统开发