码迷,mamicode.com
首页 > 其他好文 > 详细

查看 sem_t

时间:2020-07-13 21:19:06      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:amp   pes   types   print   sys   查看   hello   creat   argv   

gcc get.c -o get -lpthread

#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <semaphore.h>
#include <stdio.h>
int
main(int argc,char**argv)
{
//sem_t *sem;
int val;
if(argc != 2)
return -1;
//i sem=sem_open(argv[1],O_CREAT,0777,0);

sem_t * p = sem_open(argv[1], O_CREAT, 0777, val);
sem_getvalue(p,&val);
printf("value = %d\n",val);
printf("hello,world");

}

查看 sem_t

标签:amp   pes   types   print   sys   查看   hello   creat   argv   

原文地址:https://www.cnblogs.com/hshy/p/13295655.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!