l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
November 4: Social gathering
Next Installfest:
TBD
Latest News:
Oct. 10: LUGOD Installfests coming again soon
Page last updated:
2001 Dec 30 16:57

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] pthread_cond_timedwait and timespec struct
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] pthread_cond_timedwait and timespec struct


  • Subject: Re: [vox-tech] pthread_cond_timedwait and timespec struct
  • From: Ricardo Anguiano <anguiano@cs.ucdavis.edMAPSu>
  • Date: Thu, 28 Sep 2000 10:26:56 -0700
  • References: 39D37220.835A7294@llnl.gov


Half a second is pretty short. Are you sure you are just not noticing
the wait? :) Write a small test program using the same code that waits
for 5 seconds with printf("go/stop\n")/fflush around the call, or in a
debugger.  


     anguiano@home:/usr/include$ grep ETIMEDOUT *
     errno.h:#define ETIMEDOUT       60              /* Operation timed out */


I don't know pthreads, but checking your arguments would be a good thing
to do.  What does a debugger tell you about the values of your
arguments?  Do they match the man page?  I don't see where
pcbReadyForSorter_cond and sortWaiting_lock are defined or initialized
or what they should be in order for your code to "block" for .5 seconds.

BTW are you taking Ron Olson's 244?  I highly recomend it if you like
parallel programming and do not have an aversion to program correctness
proofs.  I think the class size is small, around 15 so if you aren't
already there you probably won't get in.

-Ricardo

Richard Cook <rcook@llnl.gov> writes:

> Anyone know why pthread_cond_timedwait doesn't seem to wait at all
> (noone sends a cond_signal) for the following snippet?  I guess maybe
> I'm doing something wrong with  TIA
> 
>   struct timespec theTimeSpec = {0};
>   theTimeSpec.tv_sec = 0;
>   theTimeSpec.tv_nsec = 500000000;/* 500.0 milliseconds */
>   err = pthread_cond_timedwait(&pcbReadyForSorter_cond,
> &sortWaiting_lock, 
>                          &theTimeSpec);
> 
> when it returns, err = 147, which I can't seem to find the meaning of.
> When I try to test (err == ETIMEDOUT), my compiler complains that
> ETIMEDOUT is not defined.  Wasup?


LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.