Hi,
I was programming with POSIX threads and I was using semaphores. All of a sudden the program didn't work anymore, and I started searching for the problem. It turns out that my first semaphore command "sem_open()" causes the problem. It returns value "0", or "SEM_FAILED", and sets errno to a random value, which gives me "Unknown error".
I tried to make a stub program with just the sem_open(), and it fails too. I'm helpless!
Here's my stub code:
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <semaphore.h>
sem_t* sem;
int main(int argc, char** argv) {
sem = sem_open("mysem", 1);
if(sem == SEM_FAILED) {
printf("Error! %d, %s\n", sem, gai_strerror(sem));
}
return 0;