0

Hello, there. I'm having trouble with the initialization of variable of type sem_t.

I used this.

sem_t example;

example = NULL;

if(example == NULL){
    /* code here */
}

I'm getting the error, "no match for operator ==".

What value do you think I should place in the initialization?

I tried 0, but still the same.

Thanks.

5
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by sfault
0

probably because you have not defined sem_t -- I never heard of it. If its an integer then assigning NULL to it is incorrect -- NULL is used for pointers, just use 0 to initialize integers.

0

I realize this is an old thread but I think I may be able to help...when you initialize sem_t you need to use the function

int sem_init( sem_t * sem, int pshared, unsigned value );

then use the return value of the function instead of comparing the actual value of the sem_t variable.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.