add function fc_sleep_us
parent
117b723274
commit
cf66174cf9
3
HISTORY
3
HISTORY
|
|
@ -1,4 +1,7 @@
|
||||||
|
|
||||||
|
Version 1.62 2022-09-27
|
||||||
|
* add function fc_sleep_us
|
||||||
|
|
||||||
Version 1.61 2022-09-21
|
Version 1.61 2022-09-21
|
||||||
* get_base_path_from_conf_file_ex support parameter: noent_log_level
|
* get_base_path_from_conf_file_ex support parameter: noent_log_level
|
||||||
* add function common_blocked_queue_push_chain
|
* add function common_blocked_queue_push_chain
|
||||||
|
|
|
||||||
|
|
@ -1176,6 +1176,23 @@ bool fc_path_contains(const string_t *path, const string_t *needle,
|
||||||
int *result);
|
int *result);
|
||||||
|
|
||||||
|
|
||||||
|
/** sleep in microseconds
|
||||||
|
* parameters:
|
||||||
|
* microseconds: microseconds to sleep
|
||||||
|
* return: 0 for success, != 0 for fail
|
||||||
|
*/
|
||||||
|
static inline int fc_sleep_us(const int microseconds)
|
||||||
|
{
|
||||||
|
struct timespec ts;
|
||||||
|
ts.tv_sec = microseconds / (1000 * 1000);
|
||||||
|
ts.tv_nsec = (microseconds % (1000 * 1000)) * 1000;
|
||||||
|
if (nanosleep(&ts, NULL) == 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return errno != 0 ? errno : EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** sleep in milliseconds
|
/** sleep in milliseconds
|
||||||
* parameters:
|
* parameters:
|
||||||
* milliseconds: milliseconds to sleep
|
* milliseconds: milliseconds to sleep
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue