From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4047 invoked by alias); 6 May 2002 14:16:14 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 4035 invoked from network); 6 May 2002 14:16:08 -0000 Received: from unknown (HELO hss.hns.com) (164.164.94.118) by sources.redhat.com with SMTP; 6 May 2002 14:16:08 -0000 Received: from sampark.hss.hns.com (hssblrmail [192.168.17.10]) by hss.hns.com (8.11.6/8.11.2) with SMTP id g46EDsH22859; Mon, 6 May 2002 19:44:10 +0530 Received: by sampark.hss.hns.com(Lotus SMTP MTA Internal build v4.6.2 (651.2 6-10-1998)) id 65256BB1.004E4280 ; Mon, 6 May 2002 19:44:48 +0530 X-Lotus-FromDomain: HSSBLR From: ssundaragopalan@hss.hns.com To: 5qduh001@sneakemail.com cc: pthreads-win32@sources.redhat.com Message-ID: <65256BB1.004E4265.00@sampark.hss.hns.com> Date: Mon, 06 May 2002 07:16:00 -0000 Subject: Re: pthread_init_mutex problem Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline X-SW-Source: 2002/txt/msg00060.txt.bz2 hi ppl, thnx for your valuble inputs. ..actually i have implmented critical section as a solution and it works fine...the CPU utilization has come down to 60% from 100%... thnx & regds, srikanth 5qduh001@sneakemail.com on 05/04/2002 02:42:43 PM To: Srikanth Sundaragopalan/HSSBLR, pthreads-win32@sources.redhat.com cc: Subject: Re: pthread_init_mutex problem I'd be interested in measurements comparing calling pthread_mutex_init() vs. using PTHREAD_MUTEX_INITIALIZER. I.e the code from the earlier e-mail: pthread_mutex_t mutex; assert(pthread_mutex_init(&mutex, NULL) == 0); vs. pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; I haven't looked at the win32 pthread source to see what happens in either, but I can only imagine that the latter would be more efficient if the implementation in win32 pthreads is anything like what most other implementations do (a linux implementation in this case), basically: pthread_mutex_t mutex = {0, 0, 0, PTHREAD_MUTEX_FAST_NP, {0, 0}}; As I understand it, using PTHREAD_MUTEX_INITIALIZER should also allow you to avoid the call to pthread_mutex_destroy() thus another saving. If the PTHREAD_MUTEX_INITIALIZER is faster as I suspect, please let us know and by roughly how much :). Good luck, Dave ----------------------------------------------------- Protect yourself from spam, use http://sneakemail.com