problem with sem_wait() please help
I am using semaphores and have initialised semaphores called PM_Full and PM_Empty like:
for(i = 0; i < MAX_NOOF_BUFFERS; i++)
sem_init(&PM_Empty[i], 0, 1); //will be shared bet. threads,but cannot be shared bet. processes /*PM Buffers as empty*/
sem_init(&PM_Full[i], 0, 0);
Desc_Buffer[i] = NULL;
Valid_Data[i] = 0;
Also we have initialised:
short int siBuffer_Select = 0;
And after few value changes finally we have:
sem_wait(&PM_Empty[siBuffer_Select]); /*check for the next buffer is empty or not*/
(here the value of siBuffer_Select is 0)
But this statement does not work, and the code hangs here giving a "segmentation fault" without any description.
Kindly suggest what might be causing the error.
|All times are GMT +5.5. The time now is 14:33.|