[so] [Tema2][Linux]Deschidere semafoare

mihai chiritescu mihaichiritescu at gmail.com
Sun Apr 19 22:03:03 EEST 2009


Am testat si acelasi rezultat. Chestia e ca la mine pe calculator merge
perfect..

Alte idei pls?

Multumesc,

Chiritescu Paul Mihai

On Sun, Apr 19, 2009 at 9:38 PM, mihai chiritescu <mihaichiritescu at gmail.com
> wrote:

> Sal.
>
> Am urmatoarea problema: clientul nu imi deschide semafoarele cu eroarea:
>
> Client:Semafor open() failed:: No such file or directory
>
> In server am declarat semafoarele si numele lor:
>             sem_t *sem[BUCKET_COUNT];
>             char sem_names[BUCKET_COUNT][20];
> Le-am denumit :
>             for(i=0;i<BUCKET_COUNT;i++){
>                 sprintf(sem_names[i],"/sem%d",i);
>             }
> Le-am deschis:
>             for(i=0;i<BUCKET_COUNT;i++){
>                 sem[i] = sem_open(sem_names[i], O_CREAT | O_RDWR, 0777, 1);
>                 if (SEM_FAILED == sem[i]) {
>                     perror("Server:Semafor open() failed:");
>                     exit(-1);
>                 }
>             }
>
> In client le-am declarat la fel ca in server si le-am denumit la fel si le-am deschis in felul urmator:
>         for(i=0;i<BUCKET_COUNT;i++){
>             sem[i] = sem_open(sem_names[i], O_EXCL);
>             if (SEM_FAILED == sem[i]) {
>                 perror("Client:Semafor open() failed:");
>                 exit(-1);
>             }
>         }
>
> Ce am gresit de nu mi le deschide in client? Stau de mult cu eroarea asta si probabil ca imi scapa mie ceva. Fara semafoare tema merge bine, dar cu semafoare nu.
>
> Multumesc anticipat,
>
> Chiritescu Paul Mihai
>
> 334CC
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090419/6cc1564a/attachment.htm>


More information about the so mailing list