Sponsored Content
Top Forums Programming nanosleep returns prematurely, with return value 0 Post 302270438 by fpmurphy on Sunday 21st of December 2008 10:22:42 PM
Old 12-21-2008
Source code for nanosleep() can be viewed in the OpenSolaris source code repository.
The relevant file is .../src/uts/common/os/timers.c.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Why does rexec cause while loop to end prematurely?

I have the following korn shell script which reads the contents of an ascii file and performs an rexec command based on the line that was just read from the ascii file. The ascii file contains 6 lines, thus, the while loop should execute 6 times. The problem is that the rexec command within the... (2 Replies)
Discussion started by: sadove
2 Replies

2. Programming

nanosleep

Hello, Can anyone, please, guide me on the use of nanosleep. I'm learning threads. I want to introduce a delay (not nested for loops, something more customizable). Nanosleep looked useful (or any other form of customizable and easy-to-use delay). Sleep is too long. :) (2 Replies)
Discussion started by: ameya
2 Replies

3. Infrastructure Monitoring

Nagios escalating prematurely

We are currently using Nagios 1.3 .The issue we facing is , when a alert is in Warning state and then from Warning it moves to Critical state ,the alert is escalated directly to L2,L3 L4 escalations,here nagios assumes that the time period ,the alert was in warning state as unacknowledged time... (0 Replies)
Discussion started by: apatil
0 Replies

4. UNIX for Advanced & Expert Users

script dies prematurely and unpredictably

Hi, I have over 5 gb of data in a files structure in which month folders are in year folders, day folders are in month folders, and individual climate stations are in each day. I am trying to extract precipitation measured at 5 minute intervals for a duration of 15 years, but the script never... (2 Replies)
Discussion started by: mlw63@me.com
2 Replies

5. Programming

Where is nanosleep?

I use nanosleep under solaris10,like follows: #include <pthread.h> #include <time.h> #include <sys/time.h> struct to_info{ void (*to_fn)(void *); void *to_arg; struct timespec to_wait; }; void *timeout_helper(void *arg){ struct to_info *tip; nanosleep(&tip->to_wait,NULL);... (1 Reply)
Discussion started by: konvalo
1 Replies

6. Shell Programming and Scripting

Background program exits prematurely?

Hello! I am currently attempting to build a very, very, basic program that attempts to act like a calendar for a "server." Using this program I need to have the client program connect to the server program, have the client wait for the server to respond through a socket, then exit and the server... (2 Replies)
Discussion started by: Entelexia
2 Replies

7. Programming

nanosleep

Application runs on both solaris 6 and 10. solaris 6 having only posix4.so library, solaris 10 having libposix4.so and librt.so Can we link application to lposix4 instead of lrt for nanosleep, sothat application will run in both machines? (2 Replies)
Discussion started by: satish@123
2 Replies

8. Shell Programming and Scripting

sqlplus returns leading carriage return into a variable

I am trying to generate some scripts to help manage an Oracle database. When I check the value returned from Oracle it has a leading carriage return in the variable. Is there a way to prevent this? Is there a way to easily strip out the carriage return. See code and output below. ... (7 Replies)
Discussion started by: Panzer993
7 Replies

9. Shell Programming and Scripting

Expect script cronjob running but dying prematurely

I have an Ubuntu machine that I'd like to update automatically. I've written an expect script to run the aptitude package manager and update my packages. Essentially it does: aptitude update && aptitude upgrade while answering "yes" at the appropriate time. It works quite nicely when run... (4 Replies)
Discussion started by: CluelessPerson
4 Replies

10. Programming

Nanosleep in signal call

Hi @ll :) I have a problem with my code but first a short description: 1. I have one signal call SIGUSR1 2. In the signal I try to use nanosleep and now: When I put kill -SIGUSR1 pid --> sometimes works fine, sometimes returns me an error with ,,Interrupt system call", sometimes I got... (5 Replies)
Discussion started by: mattdj
5 Replies
NANOSLEEP(2)						      BSD System Calls Manual						      NANOSLEEP(2)

NAME
nanosleep -- suspend thread execution for an interval measured in nanoseconds LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <time.h> int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); DESCRIPTION
The nanosleep() function causes the calling thread to sleep for the amount of time specified in rqtp (the actual time slept may be longer, due to system latencies and possible limitations in the timer resolution of the hardware). An unmasked signal will cause nanosleep() to ter- minate the sleep early, regardless of the SA_RESTART value on the interrupting signal. RETURN VALUES
If nanosleep() returns because the requested time has elapsed, the value returned will be zero. If nanosleep() returns due to the delivery of a signal, the value returned will be the -1, and the global variable errno will be set to indi- cate the interruption. If rmtp is non-NULL, the timespec structure it references is updated to contain the unslept amount (the request time minus the time actually slept). ERRORS
The nanosleep() call fails if: [EINTR] nanosleep() was interrupted by the delivery of a signal. [EINVAL] rqtp specified a nanosecond value less than zero or greater than or equal to 1000 million. SEE ALSO
sigsuspend(2), sleep(3) STANDARDS
The nanosleep() function conforms to IEEE Std 1003.1b-1993 (``POSIX.1''). BSD
April 17, 1997 BSD
All times are GMT -4. The time now is 12:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy