BRL-CAD
snooze.h
Go to the documentation of this file.
1 /* S N O O Z E . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2018-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file snooze.h
21  *
22  * Routines for suspending the current thread of execution.
23  *
24  */
25 
26 #ifndef BU_SNOOZE_H
27 #define BU_SNOOZE_H 1
28 
29 #include "common.h"
30 
31 #include "bu/defines.h"
32 
33 __BEGIN_DECLS
34 
35 /**
36  * Convert seconds to microseconds
37  */
38 #define BU_SEC2USEC(sec) (1000000LL * (sec))
39 
40 
41 /**
42  * suspend the current thread for at least the specified number of
43  * microseconds.
44  *
45  * this is a portability replacement for usleep(3).
46  *
47  * returns 0 on success, non-zero on error
48  */
49 BU_EXPORT extern int bu_snooze(int64_t useconds);
50 
51 __END_DECLS
52 
53 #endif /* BU_SNOOZE_H */
54 
55 /*
56  * Local Variables:
57  * tab-width: 8
58  * mode: C
59  * indent-tabs-mode: t
60  * c-file-style: "stroustrup"
61  * End:
62  * ex: shiftwidth=4 tabstop=8
63  */
Header file for the BRL-CAD common definitions.
int bu_snooze(int64_t useconds)