Semaphore initilisation

Hi,
I am having a problem attempting to initialise semaphores.

I am creating some shared memory for the sem_t structure, then passing the
pointer to this memory to the sem_init function.

The sem_init function is failing with errno 11, Resource temporarily
unavailable. I create 9 semaphores at startup, and all of them fail in the
same way.

What resouces is unavailable? I cannot find any reference to what sem_init
actually does.

The sem_t structure when passed to sem_init is 0 for the value and the
sem_id, and the value is set to 1 after sem_init. The sem_id is still 0.

Any help much appreciated
Rodney


Rodney Gullickson
Project Engineer
Tritronics (Australia) Pty Ltd
Ph (61) 7 3891 9772
Email: rodneyg@tritro.com.au

Rodney <rodneyg@tritro.com.au> wrote:

Hi,
I am having a problem attempting to initialise semaphores.

I am creating some shared memory for the sem_t structure, then passing the
pointer to this memory to the sem_init function.

The sem_init function is failing with errno 11, Resource temporarily
unavailable. I create 9 semaphores at startup, and all of them fail in the
same way.

What resouces is unavailable? I cannot find any reference to what sem_init
actually does.

Proc32 only allows a limitted number of semaphores (for the whole system).
This value is controlled by the -e option to Proc, and defaults to 125.
Have you created 125 semaphores before this point? Or, have you modified
this option to Proc? (“sin args” run as root will give you Proc’s
command line arguments.)

Have you tried the sample semaphore code in /usr/demo/src/semaphores?
Does it run properly?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

“Rodney” <rodneyg@tritro.com.au> wrote in message
news:bi1spm$j7b$1@inn.qnx.com

Hi,
I am having a problem attempting to initialise semaphores.

I am creating some shared memory for the sem_t structure, then passing the
pointer to this memory to the sem_init function.

The sem_init function is failing with errno 11,

Failling as in returning -1?

Resource temporarily
unavailable. I create 9 semaphores at startup, and all of them fail in
the
same way.

What resouces is unavailable? I cannot find any reference to what
sem_init
actually does.

Can you post code? You might have some problem with your setup of
shared memory.

The sem_t structure when passed to sem_init is 0 for the value and the
sem_id, and the value is set to 1 after sem_init. The sem_id is still 0.

Any help much appreciated
Rodney


Rodney Gullickson
Project Engineer
Tritronics (Australia) Pty Ltd
Ph (61) 7 3891 9772
Email: > rodneyg@tritro.com.au