[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9400.0. "pthread_delay_np & sleep" by CSC32::D_MAHDER () Sat Apr 05 1997 01:41

    pthread_delay_np & sleep
    
    What is the max value of interval for the pthread_delay_np function
    in DUNIX 4.0 ?
    
    What is the max value of seconds for the sleep function in DUNIX 3.2d-2 
    and 4.0 ?
    
    thanks...
T.RTitleUserPersonal
Name
DateLines
9400.1DCETHD::BUTENHOFDave Butenhof, DECthreadsMon Apr 07 1997 07:0317
The pthread_delay_np function converts your "delta" (relative time) struct
timespec into an absolute time. The struct timespec format expresses the date
as the number of seconds (and nanoseconds) since the UNIX Epoch, Jan 1
00:00:00 UTC 1970. The count of seconds (a time_t) is expressed as a signed
32 bit integer, which gives a maximum timeout of about Feb 4 03:14:07 UTC
2038. (That is, ignoring the nanoseconds field, which, if you want to get
technical about it, could be taken to increase the maximum expiration to one
nanosecond short of 03:14:08.)

The sleep(3) function argument is an unsigned int, but, currently, sleep
actually calls a kernel function that takes a relative time expressed as a
struct timeval -- which again uses a time_t (signed int) for the seconds.
However, sleep() explicitly limits the seconds to 100000000
(TOD_MAX_SECONDS). That gives a maximum timeout of 3 years, 62 days, 9 hours,
46 minutes, 40 seconds from the current time.

	/dave