select() and timeout

From doc / fn select():
"Programs using select() with a timeout should reset their
timeout value after calling select(). (In QNX, on return from
the select() call, timeout contains the amount of time
remaining
, and not the original timeout value. However, this
may not be portable). "

Is it really true ( in QNX )? I tried example from docs and timeout never
containts remaining time.

Martin Michalek wrote:

From doc / fn select():
"Programs using select() with a timeout should reset their
timeout value after calling select(). (In QNX, on return from
the select() call, timeout contains the amount of time
remaining
, and not the original timeout value. However, this
may not be portable). "

Is it really true ( in QNX )? I tried example from docs and timeout never
containts remaining time.

Nope, seems the most recent revisions do not actually damage the timeout
value (ala. UNIX) contrary to what the docs actually say.

I’ve attached a lib with an alternate implementation of select() with
the timeout being updated as doc’d. In your cc line use:

cc -o myprog myprog.c -l altsel -L.

(-L should include the path to the altsel.lib file, I’ve just put . as
the current directory for simplicity) to build against that static lib.

Alternatively, you could implement your own timeout around select() and
use timer_gettime() to query the amount of time remaining.

Hope that helps.

Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>