English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

res = sem_init(&produced, 0, 1);
if (res != 0) {
perror("Semaphore creation failed");
exit(EXIT_FAILURE);
}

res = sem_init(&consumed, 0, 0);
if (res != 0) {
perror("Semaphore creation failed");
exit(EXIT_FAILURE);
}

2007-02-26 00:54:33 · 1 answers · asked by Onikids 2 in Computers & Internet Programming & Design

1 answers

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

sem_init initializes the semaphore object pointed to by sem. The count associated with the semaphore is set initially to value.

The pshared argument indicates whether the semaphore is local to the current process ( pshared is zero) or is to be shared between several processes (pshared is not zero).

2007-02-26 01:02:24 · answer #1 · answered by Neil 5 · 0 0

fedest.com, questions and answers