Exemple #1
0
int semaphore_create()
{
	int flag_sem = O_CREAT|O_RDWR;
	int init_value = 1;

	semaphore_unlink(SEM_NAME);
	
	if (semaphore_open(SEM_NAME, flag_sem, FILE_MODE, init_value) == -1)
	{
		perror("semaphore_create fail");
		return -1;
	}

	return 0;
}
Exemple #2
0
 static bool remove(const char *name)
 {  return semaphore_unlink(name);   }