Unix Programming Shared Memory strange results

后端 未结 1 762
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-16 16:23

I have been working on semaphores and shared memory for a week now, and have some difficulties yet,so i tried to make this program which the children are supposed to write t

1条回答
  •  滥情空心
    2021-01-16 17:15

    The code calls fork() in two places. Remove the second call.

    Change:

        if((child[i] =fork())==0){
    

    to:

        if(child[i] == 0){
    

    0 讨论(0)
提交回复
热议问题