source: rtems/cpukit/posix/src/pthreadequal.c @ e7bd66a7

4.104.114.84.95
Last change on this file since e7bd66a7 was 8e36f29, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:54:26

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/posix/cond.h, include/rtems/posix/condmp.h, include/rtems/posix/config.h, include/rtems/posix/intr.h, include/rtems/posix/key.h, include/rtems/posix/mqueue.h, include/rtems/posix/mqueuemp.h, include/rtems/posix/mutex.h, include/rtems/posix/mutexmp.h, include/rtems/posix/posixapi.h, include/rtems/posix/pthread.h, include/rtems/posix/pthreadmp.h, include/rtems/posix/ptimer.h, include/rtems/posix/semaphore.h, include/rtems/posix/semaphoremp.h, inline/rtems/posix/cond.inl, inline/rtems/posix/intr.inl, inline/rtems/posix/key.inl, inline/rtems/posix/mqueue.inl, inline/rtems/posix/mutex.inl, inline/rtems/posix/pthread.inl, inline/rtems/posix/semaphore.inl, inline/rtems/posix/timer.inl, macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl, macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl, macros/rtems/posix/mutex.inl, macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl, macros/rtems/posix/timer.inl, src/alarm.c, src/kill.c, src/killinfo.c, src/mqueuetranslatereturncode.c, src/pause.c, src/pthreadattrdestroy.c, src/pthreadattrgetdetachstate.c, src/pthreadattrgetinheritsched.c, src/pthreadattrgetschedparam.c, src/pthreadattrgetschedpolicy.c, src/pthreadattrgetscope.c, src/pthreadattrgetstackaddr.c, src/pthreadattrgetstacksize.c, src/pthreadattrinit.c, src/pthreadattrsetdetachstate.c, src/pthreadattrsetinheritsched.c, src/pthreadattrsetschedparam.c, src/pthreadattrsetschedpolicy.c, src/pthreadattrsetscope.c, src/pthreadattrsetstackaddr.c, src/pthreadattrsetstacksize.c, src/pthreadcreate.c, src/pthreaddetach.c, src/pthreadequal.c, src/pthreadexit.c, src/pthreadgetcpuclockid.c, src/pthreadgetcputime.c, src/pthreadgetschedparam.c, src/pthreadjoin.c, src/pthreadkill.c, src/pthreadonce.c, src/pthreadself.c, src/pthreadsetcputime.c, src/pthreadsetschedparam.c, src/pthreadsigmask.c, src/sigaction.c, src/sigaddset.c, src/sigdelset.c, src/sigemptyset.c, src/sigfillset.c, src/sigismember.c, src/signal_2.c, src/sigpending.c, src/sigprocmask.c, src/sigqueue.c, src/sigsuspend.c, src/sigtimedwait.c, src/sigwait.c, src/sigwaitinfo.c, src/ualarm.c: URL for license changed.
  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
3 *
4 *  NOTE:  POSIX does not define the behavior when either thread id is invalid.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#if HAVE_CONFIG_H
17#include "config.h"
18#endif
19
20#include <pthread.h>
21#include <errno.h>
22
23#include <rtems/system.h>
24#include <rtems/posix/pthread.h>
25#include <rtems/score/thread.h>
26
27int pthread_equal(
28  pthread_t  t1,
29  pthread_t  t2
30)
31{
32  /*
33   *  If the system is configured for debug, then we will do everything we
34   *  can to insure that both ids are valid.  Otherwise, we will do the
35   *  cheapest possible thing to determine if they are equal.
36   */
37
38#ifndef RTEMS_DEBUG
39  return _Objects_Are_ids_equal( t1, t2 );
40#else
41  int               status;
42  Objects_Locations location;
43
44  /*
45   *  By default this is not a match.
46   */
47
48  status = 0;
49
50  /*
51   *  Validate the first id and return 0 if it is not valid
52   */
53
54  (void) _POSIX_Threads_Get( t1, &location );
55  switch ( location ) {
56    case OBJECTS_ERROR:
57    case OBJECTS_REMOTE:
58      break;
59
60    case OBJECTS_LOCAL:
61
62      /*
63       *  Validate the second id and return 0 if it is not valid
64       */
65
66      (void) _POSIX_Threads_Get( t2, &location );
67      switch ( location ) {
68        case OBJECTS_ERROR:
69        case OBJECTS_REMOTE:
70          break;
71        case OBJECTS_LOCAL:
72          status = _Objects_Are_ids_equal( t1, t2 );
73          break;
74      }
75      _Thread_Unnest_dispatch();
76      break;
77  }
78
79  _Thread_Enable_dispatch();
80  return status;
81#endif
82}
83
Note: See TracBrowser for help on using the repository browser.