pthread_getcpuclockid() not quite what I expected

'Chris Hall' chris.hall.list at highwayman.com
Thu Apr 19 09:57:36 UTC 2012


I use pthread_getcpuclockid() in a "watch-dog" pthread to one side of
a pthreaded application.

With FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012 the result
is a little disappointing.  The clock_id returned is the same for all
thread_ids, and is CLOCK_THREAD_CPUTIME_ID.  So, instead of reading
the cpu time for each pthread, clock_gettime() in the watch-dog
pthread reads its own cpu time :-(

This is not quite what POSIX lead me to hope for.

Is there something more modern I should be using ?

Chris
-- 
Chris Hall,  Highwayman




More information about the freebsd-threads mailing list