1 /* Helper code for POSIX timer implementation on NPTL.
2 Copyright (C) 2000-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but 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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If
18 not, see <http://www.gnu.org/licenses/>. */
20 #ifndef _TIMER_ROUTINES_H
21 #define _TIMER_ROUTINES_H 1
23 #include <internaltypes.h>
26 /* Compare two pthread_attr_t thread attributes for exact equality.
27 Returns 1 if they are equal, otherwise zero if they are not equal
28 or contain illegal values. This version is NPTL-specific for
29 performance reason. One could use the access functions to get the
30 values of all the fields of the attribute structure. */
32 thread_attr_compare (const pthread_attr_t
*left
, const pthread_attr_t
*right
)
34 struct pthread_attr
*ileft
= (struct pthread_attr
*) left
;
35 struct pthread_attr
*iright
= (struct pthread_attr
*) right
;
37 return (ileft
->flags
== iright
->flags
38 && ileft
->schedpolicy
== iright
->schedpolicy
39 && (ileft
->schedparam
.sched_priority
40 == iright
->schedparam
.sched_priority
)
41 && ileft
->guardsize
== iright
->guardsize
42 && ileft
->stackaddr
== iright
->stackaddr
43 && ileft
->stacksize
== iright
->stacksize
44 && ((ileft
->cpuset
== NULL
&& iright
->cpuset
== NULL
)
45 || (ileft
->cpuset
!= NULL
&& iright
->cpuset
!= NULL
46 && ileft
->cpusetsize
== iright
->cpusetsize
47 && memcmp (ileft
->cpuset
, iright
->cpuset
,
48 ileft
->cpusetsize
) == 0)));
51 #endif /* timer_routines.h */