当前位置:网站首页>7.3 creating threads
7.3 creating threads
2022-04-21 23:36:00 【Big lion bear】
1、 Experimental code
#include <stdio.h>
#include <pthread.h>
#include <errno.h>
#include <stdlib.h>
void *thread_start (void *arg)
{
int arg_data = *((int *)arg);
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 50000; j++);
printf ("Receive arg%d = %d\n", arg_data, arg_data);
}
}
int main (void)
{
pthread_t tid;
int arg1 = 1;
int arg2 = 2;
int ret = pthread_create (&tid, NULL, thread_start, (void *)&arg1);
if (ret)
{
perror ("pthread_create");
exit (EXIT_FAILURE);
}
thread_start ((void *) &arg2);
return 0;
}
2、 experimental result

版权声明
本文为[Big lion bear]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204212331108656.html
边栏推荐
- Section II introduction to yolov3 tiny and Darknet
- leetcode:271.字符串的编码与解码
- Signal to noise ratio and signal to interference noise ratio
- [reprint] postman omysql connection database
- Bit by bit concentrated and clean, the way to break the situation in the detergent industry
- vmware-vmx. Exe could not end the process
- Cuda02 - memory access optimization and unified memory
- 341 Linux connection database
- 6. Protocol hierarchy and service model (key)
- Click, walk and move of characters in 3D sandbox game
猜你喜欢
随机推荐
341-Linux 连接数据库
Golang force buckle leetcode 388 The longest absolute path of the file
DetNet: A Backbone network for Object Detection
Wechat server configuration
LeetCode_ 746 climbing stairs with minimum cost
文件操作和IO
7-1 对象数组 (100 分)
TextView 倾斜属性
【接口测试基础】第三篇 | 传统风格接口与RESTful风格接口区别
Electronic address book management system based on C
[ffmpeg] command line
leetcode:271.字符串的编码与解码
入参有汉字,报错500,服务器内部错误
Leetcode每日一题824. 山羊拉丁文
339 leetcode word rules
C language: simple profit and bonus
. 101 keyboard events
(3) Ruixin micro rk3568 SSH replaces dropbear
Pytorch中如何获取某层Module?(方便改变梯度,获取特征图,CAM等)
[wrapper (1)]









