From 9ef3a9f8b2704693496af12120ea3ab40389bf7b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 24 Oct 2016 02:15:36 +0000 Subject: Add the alarm library, first draft. --- doc/libstddjb/alarm.html | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ doc/libstddjb/index.html | 1 + 2 files changed, 95 insertions(+) create mode 100644 doc/libstddjb/alarm.html (limited to 'doc/libstddjb') diff --git a/doc/libstddjb/alarm.html b/doc/libstddjb/alarm.html new file mode 100644 index 0000000..da14267 --- /dev/null +++ b/doc/libstddjb/alarm.html @@ -0,0 +1,94 @@ + + + + + + skalibs: the alarm library interface + + + + + + +

+libstddjb
+libskarnet
+skalibs
+Software
+skarnet.org +

+ +

The alarm library interface

+ +

+ The following functions are declared in the skalibs/alarm.h header, +and implemented in the libskarnet.a or libskarnet.so library. +

+ +

General information

+ +

+ alarm is a set of primitives to provide the same functionality as +alarm(), +but with sub-second precision. +

+ +

+ Depending on the functionality the underlying system provides, +the precision can be 1 nanosecond (implementation via +timer_settime(), +1 microsecond (implementation via +setitimer(), +or 1 second (fallback implementation with +alarm() +when nothing better can be found). +

+ +

Functions

+ +

+ int alarm_milliseconds (unsigned int n)
+Sets a fuse that will raise a SIGALRM after n milliseconds. +If n is 0, the SIGALRM will be raised instantly. +Returns 1 on success and 0 (and sets errno) on failure. +

+ +

+ int alarm_timeout (tain_t const *tto)
+Sets a fuse that will raise a SIGALRM after some amount +of time has passed. The amount of time is described in +*tto, which is a relative +tain_t, i.e. a structure containing +a relative TAIN64 time. +Returns 1 on success and 0 (and sets errno) on failure. +

+ +

+ int alarm_deadline (tain_t const *deadline)
+Sets a fuse that will raise a SIGALRM when the clock reaches +*deadline, which is an absolute time expressed in +TAI64N format. +Returns 1 on success and 0 (and sets errno) on failure. +

+ +

+ void alarm_disable (void)
+Cancels a previously set fuse. No SIGALRM will be raised. +

+ +

Notes

+ + + + + diff --git a/doc/libstddjb/index.html b/doc/libstddjb/index.html index dfa6f94..6ecfeb2 100644 --- a/doc/libstddjb/index.html +++ b/doc/libstddjb/index.html @@ -45,6 +45,7 @@ including them directly.

Programming