[修改] 测试

This commit is contained in:
gaoyang3513
2023-07-11 20:28:43 +08:00
parent 649283de15
commit 81f70e003a
2 changed files with 14 additions and 11 deletions

View File

@ -6,4 +6,6 @@
```shell ```shell
# Top # Top
cmake -S . -B output -G "Unix Makefiles" cmake -S . -B output -G "Unix Makefiles"
make -C output
``` ```

View File

@ -32,9 +32,10 @@ int main(){
sprintf(outpipe1,"Child process 1 is sending a message!\n"); sprintf(outpipe1,"Child process 1 is sending a message!\n");
write(fd[1],outpipe1, strlen(outpipe1)); write(fd[1],outpipe1, strlen(outpipe1));
lockf(fd[1],0,0); // 管道解锁 lockf(fd[1],0,0); // 管道解锁
sem_post(resource1); // 信号量开锁name_sem1 sem_post(resource1); // 信号量开锁name_sem1
sem_close(resource1); // 有名信号量关闭name_sem1 sem_close(resource1); // 有名信号量关闭name_sem1
exit(0); // 线程退出
exit(0); // 线程退出
} }
pid2 = fork(); pid2 = fork();