xref: /third_party/musl/compat/time32/thrd_sleep_time32.c (revision 570af302)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/musl/compat/time32/
1570af302Sopenharmony_ci#include "time32.h"
2570af302Sopenharmony_ci#include <time.h>
3570af302Sopenharmony_ci#include <threads.h>
4570af302Sopenharmony_ci#include <errno.h>
5570af302Sopenharmony_ci
6570af302Sopenharmony_ciint __thrd_sleep_time32(const struct timespec32 *req32, struct timespec32 *rem32)
7570af302Sopenharmony_ci{
8570af302Sopenharmony_ci	struct timespec rem;
9570af302Sopenharmony_ci	int ret = thrd_sleep((&(struct timespec){
10570af302Sopenharmony_ci		.tv_sec = req32->tv_sec, .tv_nsec = req32->tv_nsec}), &rem);
11570af302Sopenharmony_ci	if (ret<0 && errno==EINTR && rem32) {
12570af302Sopenharmony_ci		rem32->tv_sec = rem.tv_sec;
13570af302Sopenharmony_ci		rem32->tv_nsec = rem.tv_nsec;
14570af302Sopenharmony_ci	}
15570af302Sopenharmony_ci	return ret;
16570af302Sopenharmony_ci}
17

Indexes created Thu Nov 07 10:32:03 CST 2024