From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18421 invoked by alias); 27 Sep 2005 11:13: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 18354 invoked by uid 22791); 27 Sep 2005 11:13:05 -0000 Received: from opterone.unito.it (HELO mail-out.unito.it) (130.192.119.88) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 27 Sep 2005 11:13:05 +0000 Received: (from root@localhost) by mail-out.unito.it (8.12.3/8.12.3/Debian -4) id j8RBD3G4012726 for ; Tue, 27 Sep 2005 13:13:03 +0200 Received: from webservices.unito.it (webservices.unito.it [130.192.119.81]) by mail-out.unito.it (8.12.3/8.12.3/Debian -4) with ESMTP id j8RBCxSL012695 for ; Tue, 27 Sep 2005 13:12:59 +0200 Received: from 130.192.136.198 (SquirrelMail authenticated user lfu); by webservices.unito.it with HTTP; Tue, 27 Sep 2005 13:12:58 +0200 (CEST) Message-ID: <1402.130.192.136.198.1127819578.squirrel@130.192.136.198> Date: Tue, 27 Sep 2005 11:13:00 -0000 Subject: Problem with pthread_cond_timedwait() From: "Fu Limin" To: pthreads-win32@sources.redhat.com Reply-To: limin.fu@ircc.it User-Agent: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Inrete-Amavisjob-Virus-Scanned: PDAmail Multiple Antivirus with ClamAv X-Inrete-Amavisjob-Service-Runned: 6 (j8RBCxSL012695) X-Inrete-Amavisjob-Service-Disabled: No Service disabled (j8RBCxSL012695) X-SW-Source: 2005/txt/msg00118.txt.bz2 Hello, There is a strange problem with pthread_cond_timedwait() in my program using pthread-win32, I found it doesn't wait at all. Here is part of the codes, struct timespec timeout; timeout.tv_sec = time(NULL) + 10; timeout.tv_nsec = 0; pthread_cond_timedwait( & myCondVar, & mutex->myMutex, &timeout ); This part works as expected under linux. The compiler I used is gcc3.4.2, and I used the pre-built pthread-win32, v2.7. Am I using pthread_cond_timedwait() properly? Another question, I saw in pthread documentations that the "timeout" is prepare in the following way, struct timeval now; struct timespec timeout; gettimeofday(&now); timeout.tv_sec = now.tv_sec + 5; timeout.tv_nsec = now.tv_usec * 1000; But I found it won't work without modification, in Linux, it complain gettimeofday() needs another parameter (something like timezone, if I remember well), and in Windows the compiler complain gettimeofday() is not defined. So what is the "most" standard or correct way to prepare "timeout"? Thanks a lot, Limin PS, I was trying to send this email by my gmail account, but it didn't work with this mailling list.