[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    Re: [LTP] [POSIX][PATCH]Fix bug of "pthread_rwlock_timedwrlock" test
From:       Cyril Hrubis <chrubis () suse ! cz>
Date:       2011-03-31 16:41:59
Message-ID: 20110331164159.GA11109 () saboteur ! suse ! cz
[Download RAW message or body]

Hi!
>  static pthread_rwlock_t rwlock;
>  static int thread_state;
> -static int currsec1, currsec2;
>  static int expired;
>  
>  /* thread_state indicates child thread state:
> @@ -50,12 +51,14 @@ static int expired;
>  static void* fn(void *arg)
>  {
>  	struct timespec abs_timeout;
> +	struct timeval curt;
>  	int rc;
>  	thread_state = ENTERED_THREAD;
>  
>  	/* Absolute time, not relative. */
> -	abs_timeout.tv_sec = currsec1 - TIMEOUT;
> -	abs_timeout.tv_nsec = 0;
> +	gettimeofday(&curt, NULL);

The time passed to the pthread_rwlock_timedwrlock() should be based on
clock_gettime(CLOKC_REALTIME, ...).

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic