From owner-p4-projects@FreeBSD.ORG Sat Apr 15 23:37:02 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B01A616A402; Sat, 15 Apr 2006 23:37:02 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F6EF16A400 for ; Sat, 15 Apr 2006 23:37:02 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5ADFE43D46 for ; Sat, 15 Apr 2006 23:37:02 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3FNb2SR061843 for ; Sat, 15 Apr 2006 23:37:02 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3FNb2AH061837 for perforce@freebsd.org; Sat, 15 Apr 2006 23:37:02 GMT (envelope-from jb@freebsd.org) Date: Sat, 15 Apr 2006 23:37:02 GMT Message-Id: <200604152337.k3FNb2AH061837@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 95369 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Apr 2006 23:37:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=95369 Change 95369 by jb@jb_freebsd2 on 2006/04/15 23:36:32 FreeBSD's semaphores are a bit different. Affected files ... .. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/barrier.c#2 edit .. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/barrier.h#2 edit Differences ... ==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/barrier.c#2 (text) ==== @@ -38,7 +38,9 @@ */ #include +#if defined(sun) #include +#endif #include #include "barrier.h" @@ -47,7 +49,11 @@ barrier_init(barrier_t *bar, int nthreads) { pthread_mutex_init(&bar->bar_lock, NULL); +#if defined(sun) sema_init(&bar->bar_sem, 0, USYNC_THREAD, NULL); +#else + sem_init(&bar->bar_sem, 0, 0); +#endif bar->bar_numin = 0; bar->bar_nthr = nthreads; @@ -60,7 +66,11 @@ if (++bar->bar_numin < bar->bar_nthr) { pthread_mutex_unlock(&bar->bar_lock); +#if defined(sun) sema_wait(&bar->bar_sem); +#else + sem_wait(&bar->bar_sem); +#endif return (0); @@ -70,7 +80,11 @@ /* reset for next use */ bar->bar_numin = 0; for (i = 1; i < bar->bar_nthr; i++) +#if defined(sun) sema_post(&bar->bar_sem); +#else + sem_post(&bar->bar_sem); +#endif pthread_mutex_unlock(&bar->bar_lock); return (1); ==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/barrier.h#2 (text) ==== @@ -33,7 +33,12 @@ * APIs for the barrier synchronization primitive. */ +#if defined(sun) #include +#else +#include +typedef sem_t sema_t; +#endif #ifdef __cplusplus extern "C" {