semaphore init problem in linux
Hello all,
I m using sem_init() in my program. when i call this
function as
sem_t *pSem = (sem_t*)malloc(sizeof(sem_t));
sem_init(pSem, 0, 1);
it sets the values of pSem as
pSem
__sem_lock
__status 0
__spinlock 0
__sem_value 1
__sem_waiting
the value of __sem_value is 1, means only one can
enter after sem_wait() at a time.
but when make a library of this function, and then call this funciton in my application. it sets as
__sem_lock
__status 3
__spinlock 0
__sem_value 0
__sem_waiting
the value of __sem_value is zero, therefore it does
not allow anyone to enter after sem_wait().
I dont know why it is happening.
Can anyone help me plz and get rid of this problem.
Thnx & Rgds,
Marry
|