blob: ab16fa73c84098e4ca82e0a5bd5506915cfaaf55 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* vi: set sw=4 ts=4: */
2/*
3 * pause() for uClibc
4 *
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6 *
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 */
9
10#define __UCLIBC_HIDE_DEPRECATED__
11#include <sys/syscall.h>
12#include <unistd.h>
13
14#ifdef __UCLIBC_HAS_THREADS_NATIVE__
15#include <sysdep-cancel.h>
16#endif
17
18#include <signal.h>
19
20/* Suspend the process until a signal arrives.
21 This always returns -1 and sets errno to EINTR. */
22extern __typeof(pause) __libc_pause;
23int
24__libc_pause (void)
25{
26 sigset_t set;
27
28 /*__sigemptyset (&set); - why? */
29 sigprocmask (SIG_BLOCK, NULL, &set);
30
31 /* pause is a cancellation point, but so is sigsuspend.
32 So no need for anything special here. */
33
34 return sigsuspend (&set);
35}
36weak_alias (__libc_pause, pause)
37
38#ifdef __UCLIBC_HAS_THREADS_NATIVE__
39LIBC_CANCEL_HANDLED (); /* sigsuspend handles our cancellation. */
40#endif
41