X-Spam-Check-By: sourceware.org Date: Tue, 9 May 2006 20:51:45 +0200 (MEST) From: "Ivan Mari" To: cygwin AT cygwin DOT com MIME-Version: 1.0 Subject: pthread_cond_timedwait not reporting error on bad arg. X-Authenticated: #7976413 Message-ID: <9419.1147200705@www106.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com In the code below, the timespec argument to pthread_cond_timedwait() is set to an invalid value: t_nsec > 999,999,999 so, EINVAL error code should be returned. Regards, Ivan Mari #include #include #include #include #include void* start_routine( void* arg ); pthread_cond_t m_cond = PTHREAD_COND_INITIALIZER; pthread_mutex_t m_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; int main() { struct timespec t; t.tv_nsec = 1000000000; /* This value should be in the range 0 < tv_nsec < 999999999 */ t.tv_sec = 1145259964; pthread_mutex_lock( &m_lock ); printf("Entering cond wait \n"); int rv = pthread_cond_timedwait( &m_cond, &m_lock, &t ); if( rv ) { switch( rv ) { case ETIMEDOUT: printf("Error timeout before receiving signal\n"); break; case EINVAL: printf("Error invalid abstime or mutex or cond\n"); break; case EPERM: printf("Error thread doesn't own mutex\n"); break; } } printf("pthread_cond_wait returned %d\n",rv); pthread_mutex_unlock( &m_lock ); return 0; } -- Echte DSL-Flatrate dauerhaft für 0,- Euro*! "Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/