今天的学习内容在我上传的资源里面
我提供下链接供参考
http://download.csdn.net/download/lsy888520/10125365
相关代码
我提供下链接供参考
http://download.csdn.net/download/lsy888520/10125365
相关代码
1.C
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
sem_t sem1, sem2;
void *fun1(void *arg1)
{
while(1)
{
sem_wait(&sem1);
printf("i am thread 11!\n");
sleep(1);
sem_post(&sem1);
}
}
void *fun2(void *arg1)
{
#include <pthread.h>
#include <semaphore.h>
sem_t sem1, sem2;
void *fun1(void *arg1)
{
while(1)
{
sem_wait(&sem1);
printf("i am thread 11!\n");
sleep(1);
sem_post(&sem1);
}
}
void *fun2(void *arg1)
{