pthread_mutex_timedlock base on the CLOCK_MONOTONIC

In Rob Krten book at page 210 is taking about the pthread_mutex_timedlock
base on the CLOCK_MONOTONIC instead of the CLOCK_REALTIME, but the QNX doc
is saying that the function is base on CLOCK_REAL_TIME.

Our test show this function is affected is we change the realtime clock. Is
the any other mutex or semaphore function not affected by the change of the
realtime clock. We need this for a monitoring system in a train. When two
wagon are connected together they must adjust their time but we don’t want
this change of time to affect mutex and timer.

Thanks

Rejean Senecal <rsenecal@oerlikon.ca-no-spam> wrote:

In Rob Krten book at page 210 is taking about the pthread_mutex_timedlock
base on the CLOCK_MONOTONIC instead of the CLOCK_REALTIME, but the QNX doc
is saying that the function is base on CLOCK_REAL_TIME.

CLOCK_REALTIME

Our test show this function is affected is we change the realtime clock. Is
the any other mutex or semaphore function not affected by the change of the
realtime clock.

For a quick fix, one could take the source from cvs.qnx.com:
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/lib/c/1d/pthread_mutex_timedlock.c
and change CLOCK_REALTIME to CLOCK_MONOTONIC (and change name of the
function) and link with the your modified code.


Kirk Russell Bridlewood Software Testers Guild

I’ve already posted a response in this newsgroup directly answering this
question. Included in it was a clock monotonic version of
pthread_mutex_timed_lock().

Group: qdn.public.qnxrtp.devtools
Subject: Re: CLOCK_MONOTONIC


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>

“kirk” <kirussel@NOSPAMrogers.com> wrote in message
news:aeomvc$8a$1@inn.qnx.com

Rejean Senecal <> rsenecal@oerlikon.ca-no-spam> > wrote:
In Rob Krten book at page 210 is taking about the
pthread_mutex_timedlock
base on the CLOCK_MONOTONIC instead of the CLOCK_REALTIME, but the QNX
doc
is saying that the function is base on CLOCK_REAL_TIME.

CLOCK_REALTIME

Our test show this function is affected is we change the realtime clock.
Is
the any other mutex or semaphore function not affected by the change of
the
realtime clock.

For a quick fix, one could take the source from cvs.qnx.com:
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/lib/c/1d/pthread_mutex_timedlock.c
and change CLOCK_REALTIME to CLOCK_MONOTONIC (and change name of the
function) and link with the your modified code.


Kirk Russell Bridlewood Software Testers Guild