xref: /relibc/pthreads-emb/pthread_equal.c (revision a12978ccca4c576f02971f5cfc2cbefe23e4daba)
1062c5bc4SJason Schmidlapp /*
2062c5bc4SJason Schmidlapp  * pthread_equal.c
3062c5bc4SJason Schmidlapp  *
4062c5bc4SJason Schmidlapp  * Description:
5062c5bc4SJason Schmidlapp  * This translation unit implements miscellaneous thread functions.
6062c5bc4SJason Schmidlapp  *
7062c5bc4SJason Schmidlapp  * --------------------------------------------------------------------------
8062c5bc4SJason Schmidlapp  *
9062c5bc4SJason Schmidlapp  *      Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
10062c5bc4SJason Schmidlapp  *      Copyright(C) 2008 Jason Schmidlapp
11062c5bc4SJason Schmidlapp  *
12062c5bc4SJason Schmidlapp  *      Contact Email: jschmidlapp@users.sourceforge.net
13062c5bc4SJason Schmidlapp  *
14062c5bc4SJason Schmidlapp  *
15062c5bc4SJason Schmidlapp  *      Based upon Pthreads-win32 - POSIX Threads Library for Win32
16062c5bc4SJason Schmidlapp  *      Copyright(C) 1998 John E. Bossom
17062c5bc4SJason Schmidlapp  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
18062c5bc4SJason Schmidlapp  *
19062c5bc4SJason Schmidlapp  *      Contact Email: rpj@callisto.canberra.edu.au
20062c5bc4SJason Schmidlapp  *
21062c5bc4SJason Schmidlapp  *      The original list of contributors to the Pthreads-win32 project
22062c5bc4SJason Schmidlapp  *      is contained in the file CONTRIBUTORS.ptw32 included with the
23062c5bc4SJason Schmidlapp  *      source code distribution. The list can also be seen at the
24062c5bc4SJason Schmidlapp  *      following World Wide Web location:
25062c5bc4SJason Schmidlapp  *      http://sources.redhat.com/pthreads-win32/contributors.html
26062c5bc4SJason Schmidlapp  *
27062c5bc4SJason Schmidlapp  *      This library is free software; you can redistribute it and/or
28062c5bc4SJason Schmidlapp  *      modify it under the terms of the GNU Lesser General Public
29062c5bc4SJason Schmidlapp  *      License as published by the Free Software Foundation; either
30062c5bc4SJason Schmidlapp  *      version 2 of the License, or (at your option) any later version.
31062c5bc4SJason Schmidlapp  *
32062c5bc4SJason Schmidlapp  *      This library is distributed in the hope that it will be useful,
33062c5bc4SJason Schmidlapp  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
34062c5bc4SJason Schmidlapp  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
35062c5bc4SJason Schmidlapp  *      Lesser General Public License for more details.
36062c5bc4SJason Schmidlapp  *
37062c5bc4SJason Schmidlapp  *      You should have received a copy of the GNU Lesser General Public
38062c5bc4SJason Schmidlapp  *      License along with this library in the file COPYING.LIB;
39062c5bc4SJason Schmidlapp  *      if not, write to the Free Software Foundation, Inc.,
40062c5bc4SJason Schmidlapp  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
41062c5bc4SJason Schmidlapp  */
42062c5bc4SJason Schmidlapp 
43062c5bc4SJason Schmidlapp #include "pthread.h"
44062c5bc4SJason Schmidlapp #include "implement.h"
45062c5bc4SJason Schmidlapp 
46062c5bc4SJason Schmidlapp 
47062c5bc4SJason Schmidlapp int
pthread_equal(pthread_t t1,pthread_t t2)48062c5bc4SJason Schmidlapp pthread_equal (pthread_t t1, pthread_t t2)
49062c5bc4SJason Schmidlapp /*
50062c5bc4SJason Schmidlapp  * ------------------------------------------------------
51062c5bc4SJason Schmidlapp  * DOCPUBLIC
52062c5bc4SJason Schmidlapp  *      This function returns nonzero if t1 and t2 are equal, else
53062c5bc4SJason Schmidlapp  *      returns nonzero
54062c5bc4SJason Schmidlapp  *
55062c5bc4SJason Schmidlapp  * PARAMETERS
56062c5bc4SJason Schmidlapp  *      t1,
57062c5bc4SJason Schmidlapp  *      t2
58062c5bc4SJason Schmidlapp  *              thread IDs
59062c5bc4SJason Schmidlapp  *
60062c5bc4SJason Schmidlapp  *
61062c5bc4SJason Schmidlapp  * DESCRIPTION
62062c5bc4SJason Schmidlapp  *      This function returns nonzero if t1 and t2 are equal, else
63062c5bc4SJason Schmidlapp  *      returns zero.
64062c5bc4SJason Schmidlapp  *
65062c5bc4SJason Schmidlapp  * RESULTS
66062c5bc4SJason Schmidlapp  *              non-zero        if t1 and t2 refer to the same thread,
67062c5bc4SJason Schmidlapp  *              0               t1 and t2 do not refer to the same thread
68062c5bc4SJason Schmidlapp  *
69062c5bc4SJason Schmidlapp  * ------------------------------------------------------
70062c5bc4SJason Schmidlapp  */
71062c5bc4SJason Schmidlapp {
72062c5bc4SJason Schmidlapp   int result;
73062c5bc4SJason Schmidlapp 
74062c5bc4SJason Schmidlapp   /*
75062c5bc4SJason Schmidlapp    * We also accept NULL == NULL - treating NULL as a thread
76062c5bc4SJason Schmidlapp    * for this special case, because there is no error that we can return.
77062c5bc4SJason Schmidlapp    */
78*a12978ccSJeremy Soller   result = ( t1 == t2 );
79062c5bc4SJason Schmidlapp 
80062c5bc4SJason Schmidlapp   return (result);
81062c5bc4SJason Schmidlapp 
82062c5bc4SJason Schmidlapp }				/* pthread_equal */
83