Date: Sat, 15 Apr 2006 01:42:47 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95298 for review Message-ID: <200604150142.k3F1glwQ089031@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95298 Change 95298 by jb@jb_freebsd2 on 2006/04/15 01:42:13 Add an inline definition for pthread_cond_reltimedwait_np(). Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/compat/thread.h#3 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/compat/thread.h#3 (text+ko) ==== @@ -54,4 +54,23 @@ #define RW_WRITE_HELD(_a) pthread_rwlock_wrheld_np(_a) #define RW_LOCK_HELD(x) (RW_READ_HELD(x) || RW_WRITE_HELD(x)) +#define timespecadd(vvp, uvp) \ + do { \ + (vvp)->tv_sec += (uvp)->tv_sec; \ + (vvp)->tv_nsec += (uvp)->tv_nsec; \ + if ((vvp)->tv_nsec >= 1000000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_nsec -= 1000000000; \ + } \ + } while (0) + +static __inline int pthread_cond_reltimedwait_np(pthread_cond_t *cvp, + pthread_mutex_t *mp, const struct timespec *reltime) +{ + struct timespec ts; + clock_gettime(CLOCK_REALTIME,&ts); + timespecadd(&ts,reltime); + return(pthread_cond_timedwait(cvp, mp, &ts)); +} + #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604150142.k3F1glwQ089031>