/[hurd]/hurd/libpthread/pthread/pt-internal.h
ViewVC logotype

Diff of /hurd/libpthread/pthread/pt-internal.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by neal, Thu Oct 10 23:05:06 2002 UTC revision 1.2 by neal, Mon May 2 22:00:34 2005 UTC
# Line 1  Line 1 
1  /* Internal defenitions for pthreads library.  /* Internal defenitions for pthreads library.
2     Copyright (C) 2000 Free Software Foundation, Inc.     Copyright (C) 2000, 2005 Free Software Foundation, Inc.
3     This file is part of the GNU C Library.     This file is part of the GNU C Library.
4    
5     The GNU C Library is free software; you can redistribute it and/or     The GNU C Library is free software; you can redistribute it and/or
# Line 134  extern int __pthread_num_threads; Line 134  extern int __pthread_num_threads;
134  /* Concurrency hint.  */  /* Concurrency hint.  */
135  extern int __pthread_concurrency;  extern int __pthread_concurrency;
136    
137  /* Array of __pthread structures and its lock.  */  /* Array of __pthread structures and its lock.  Indexed by the pthread
138       id minus one.  (Why not just use the pthread id?  Because some
139       brain-dead users of the pthread interface incorrectly assume that 0
140       is an invalid pthread id.)  */
141  extern struct __pthread **__pthread_threads;  extern struct __pthread **__pthread_threads;
142  extern pthread_rwlock_t __pthread_threads_lock;  extern pthread_rwlock_t __pthread_threads_lock;
143    
144  #define __pthread_getid(thread) \  #define __pthread_getid(thread) \
145    ({ struct __pthread *__t;                                                  \    ({ struct __pthread *__t;                                                  \
146       pthread_rwlock_rdlock (&__pthread_threads_lock);                        \       pthread_rwlock_rdlock (&__pthread_threads_lock);                        \
147       __t = __pthread_threads[thread];                                        \       __t = __pthread_threads[thread - 1];                                    \
148       pthread_rwlock_unlock (&__pthread_threads_lock);                        \       pthread_rwlock_unlock (&__pthread_threads_lock);                        \
149       __t; })       __t; })
150    
151  #define __pthread_setid(thread, pthread) \  #define __pthread_setid(thread, pthread) \
152    pthread_rwlock_wrlock (&__pthread_threads_lock);                           \    pthread_rwlock_wrlock (&__pthread_threads_lock);                           \
153    __pthread_threads[thread] = pthread;                                       \    __pthread_threads[thread - 1] = pthread;                                   \
154    pthread_rwlock_unlock (&__pthread_threads_lock);    pthread_rwlock_unlock (&__pthread_threads_lock);
155    
156  /* Similar to pthread_self, but returns the thread descriptor instead  /* Similar to pthread_self, but returns the thread descriptor instead

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26