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:
October 7: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
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



Ricardo Anguiano wrote:
> 
> 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 tried it with a 10 second value in theTimeSpec, and saw no
difference.  I check for return values less than zero and also check
errno every time and errno is always zero.  BTW, checking the return
value for ETIMEDOUT was wrong, I should have been checking errno.  
 
> 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.

The args should be ok.  It's not a locks/cond var problem;  I have
similar working code in other places.  My question is specifically about
this function's normal behavior.  It's weird that it doesn't block,
although it is true that cond_wait's can be spuriously woken up under
pthreads standard behavior.  
 
> 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.

Hmm, strange, I would think a small class size would make it EASIER to
get in...?  Thanks for the tip.

-- 
opinions expressed here are not those of my employer!  
email: rcook@llnl.gov          Rich Cook, Mail Stop L-551 Bldg-3577
Rm-1000
http://www.llnl.gov/graphics   Lawrence Livermore National Laboratory
phone (925) 423-9605 (work)    7000 East Avenue
fax (925) 423-9338             Livermore, CA 94550, USA


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.