2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
|
|
|
|
.\"
|
|
|
|
.\" This is free documentation; you can redistribute it and/or
|
|
|
|
.\" modify it under the terms of the GNU General Public License as
|
|
|
|
.\" published by the Free Software Foundation; either version 2 of
|
|
|
|
.\" the License, or (at your option) any later version.
|
|
|
|
.\"
|
|
|
|
.\" The GNU General Public License's references to "object code"
|
|
|
|
.\" and "executables" are to be interpreted as the output of any
|
|
|
|
.\" document formatting or typesetting system, including
|
|
|
|
.\" intermediate and printed output.
|
|
|
|
.\"
|
|
|
|
.\" This manual is distributed in the hope that it will be useful,
|
|
|
|
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
.\" GNU General Public License for more details.
|
|
|
|
.\"
|
|
|
|
.\" You should have received a copy of the GNU General Public
|
|
|
|
.\" License along with this manual; if not, write to the Free
|
|
|
|
.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
|
|
|
|
.\" USA.
|
|
|
|
.\"
|
|
|
|
.TH UALARM 3 2003-07-24 "" "Linux Programmer's Manual"
|
|
|
|
.SH NAME
|
|
|
|
ualarm \- schedule signal after given number of microseconds
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
/* BSD version */
|
|
|
|
.B "#include <unistd.h>"
|
|
|
|
.sp
|
2006-02-09 20:24:53 +00:00
|
|
|
.BI "unsigned int ualarm(unsigned int " usecs ", unsigned int " interval );
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
/* SUSv2 version */
|
|
|
|
.B "#define _XOPEN_SOURCE 500"
|
|
|
|
.br
|
|
|
|
.B "#include <unistd.h>"
|
|
|
|
.sp
|
|
|
|
.BI "useconds_t ualarm(useconds_t " usecs ", useconds_t " interval );
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
2005-10-19 07:07:02 +00:00
|
|
|
The \fBualarm\fP() function causes the signal SIGALRM to be sent
|
2004-11-03 13:51:07 +00:00
|
|
|
to the invoking process after (not less than)
|
|
|
|
.I usecs
|
|
|
|
microseconds.
|
|
|
|
The delay may be lengthened slightly by any system activity
|
|
|
|
or by the time spent processing the call or by the
|
|
|
|
granularity of system timers.
|
|
|
|
.LP
|
|
|
|
Unless caught or ignored, this signal will terminate the process.
|
|
|
|
.LP
|
|
|
|
If the
|
|
|
|
.I interval
|
2005-06-15 13:32:34 +00:00
|
|
|
argument is non-zero, further SIGALRM signals will be sent every
|
2004-11-03 13:51:07 +00:00
|
|
|
.I interval
|
|
|
|
microseconds after the first.
|
|
|
|
.SH "RETURN VALUE"
|
|
|
|
This function returns the number of microseconds remaining from
|
|
|
|
the previous call, or 0 when no alarm is pending.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
EINTR
|
|
|
|
Interrupted by a signal.
|
|
|
|
.TP
|
|
|
|
EINVAL
|
|
|
|
\fIusecs\fP or \fIinterval\fP is not smaller than 1000000.
|
|
|
|
(On systems where that is considered an error.)
|
|
|
|
.SH "CONFORMING TO"
|
2005-07-18 15:05:56 +00:00
|
|
|
4.3BSD, POSIX 1003.1-2003.
|
|
|
|
4.3BSD, SUSv2 and POSIX do not define any errors.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
|
|
|
The type
|
|
|
|
.B useconds_t
|
|
|
|
is an unsigned integer type capable of holding integers
|
|
|
|
in the range [0,1000000].
|
|
|
|
This type is defined by
|
|
|
|
.I <sys/types.h>
|
|
|
|
included by
|
|
|
|
.I <unistd.h>
|
|
|
|
but glibc defines it only when _XOPEN_SOURCE has a value not less than 500,
|
|
|
|
or both _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED are defined.
|
|
|
|
.\" useconds_t also gives problems on HPUX 10.
|
|
|
|
Programs will be more portable if they never mention this type explicitly.
|
|
|
|
.LP
|
|
|
|
The interaction of this function with
|
|
|
|
other timer functions such as
|
2005-11-02 11:34:24 +00:00
|
|
|
.BR alarm (),
|
|
|
|
.BR sleep (),
|
|
|
|
.BR nanosleep (),
|
|
|
|
.BR setitimer (),
|
|
|
|
.BR timer_create (),
|
|
|
|
.BR timer_delete (),
|
|
|
|
.BR timer_getoverrun (),
|
|
|
|
.BR timer_gettime (),
|
|
|
|
.BR timer_settime (),
|
|
|
|
.BR usleep ()
|
2004-11-03 13:51:07 +00:00
|
|
|
is unspecified.
|
|
|
|
.LP
|
|
|
|
This function is obsolete. Use
|
|
|
|
.BR nanosleep (2)
|
|
|
|
or
|
|
|
|
.BR setitimer (2)
|
|
|
|
instead.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR alarm (2),
|
|
|
|
.BR getitimer (2),
|
|
|
|
.BR nanosleep (2),
|
|
|
|
.BR select (2),
|
|
|
|
.BR setitimer (2),
|
|
|
|
.BR usleep (3)
|