PERFORCE change 95298 for review

John Birrell jb at FreeBSD.org
Sat Apr 15 01:42:48 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=95298

Change 95298 by jb at 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


More information about the p4-projects mailing list