NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Strange semaphore behavior, sem_init() fails with errno 4294967295 (-1)



	Hello,

	I have added some debug code in my software and I have found that
sem_init() aborts with

	"Unknown error: 4294967295"

	In man page, I can read that, if sem_init() fails, it returns:

     [EINVAL]           value exceeds SEM_VALUE_MAX.
     [ENOSPC]           Memory allocation error.
     [EPERM]            Unable to initialize a shared semaphore.

	My software start a lot of threads. In each thread, an anonymous
semaphore is initialized by sem_init() :

if (sem_init(&((*s_etat_processus).semaphore_fork), 0, 0) != 0)
{
	// Error
}

	Of course, this semaphore is destroyed by sem_destroy(). After more
than 30000 threads, sem_init() fails. Now question is : why ? And what
does mean errno 4294967295 (-1 ?) ?

	Best regards,

	JKB


Home | Main Index | Thread Index | Old Index