hi to all!
i have a question since my program keeps showing a message which is very annoying.i have asked in several forums but still i havent found a satisfying answer but i just found out about this one,so i hope my problem will get solved!
i have several sets of semaphores which i create and when i try to initialize them it keeps showing that message:
# Semaphore setting value : Invalid argument
the thing is that it started showing that message after a while as before it was ok its really strange.the environment is linux
this is what i do for each set to initialize it:
int SharedMemory::initSet1(){
union semun arg;
arg.val = 1;
for(int i=0;i<l;i++){//l is the number of sems
if (semctl(sem_set1,i,SETVAL,arg) == -1) {
perror("# Semaphore setting value ");
return -1;
}
}
return 0;
}
what could be wrong?