Deleted Added
sdiff udiff text old ( 214334 ) new ( 216641 )
full compact
1/*
2 * Copyright (C) 2005 Daniel M. Eischen <deischen@freebsd.org>
3 * Copyright (c) 2005 David Xu <davidxu@freebsd.org>
4 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>.
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 12 unchanged lines hidden (view full) ---

21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $FreeBSD: head/lib/libthr/thread/thr_private.h 214334 2010-10-25 09:16:04Z davidxu $
30 */
31
32#ifndef _THR_PRIVATE_H
33#define _THR_PRIVATE_H
34
35/*
36 * Include files.
37 */

--- 92 unchanged lines hidden (view full) ---

130#define THR_MUTEX_INITIALIZER ((struct pthread_mutex *)NULL)
131#define THR_ADAPTIVE_MUTEX_INITIALIZER ((struct pthread_mutex *)1)
132#define THR_MUTEX_DESTROYED ((struct pthread_mutex *)2)
133#define THR_COND_INITIALIZER ((struct pthread_cond *)NULL)
134#define THR_COND_DESTROYED ((struct pthread_cond *)1)
135#define THR_RWLOCK_INITIALIZER ((struct pthread_rwlock *)NULL)
136#define THR_RWLOCK_DESTROYED ((struct pthread_rwlock *)1)
137
138struct pthread_mutex {
139 /*
140 * Lock for accesses to this structure.
141 */
142 struct umutex m_lock;
143 enum pthread_mutextype m_type;
144 struct pthread *m_owner;
145 int m_count;
146 int m_refcount;
147 int m_spinloops;
148 int m_yieldloops;
149 int m_private;
150 /*
151 * Link for all mutexes a thread currently owns.
152 */
153 TAILQ_ENTRY(pthread_mutex) m_qe;
154};
155
156struct pthread_mutex_attr {
157 enum pthread_mutextype m_type;
158 int m_protocol;
159 int m_ceiling;
160};
161
162#define PTHREAD_MUTEXATTR_STATIC_INITIALIZER \
163 { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, MUTEX_FLAGS_PRIVATE }
164
165struct pthread_cond {
166 struct umutex c_lock;
167 struct ucond c_kerncv;
168 int c_pshared;
169 int c_clockid;
170};
171
172struct pthread_cond_attr {
173 int c_pshared;
174 int c_clockid;
175};
176
177struct pthread_barrier {

--- 62 unchanged lines hidden (view full) ---

240 void *stackaddr_attr;
241 size_t stacksize_attr;
242 size_t guardsize_attr;
243#define pthread_attr_end_copy cpuset
244 cpuset_t *cpuset;
245 size_t cpusetsize;
246};
247
248/*
249 * Thread creation state attributes.
250 */
251#define THR_CREATE_RUNNING 0
252#define THR_CREATE_SUSPENDED 1
253
254/*
255 * Miscellaneous definitions.

--- 95 unchanged lines hidden (view full) ---

351 TAILQ_ENTRY(pthread) tle; /* link for all threads in process */
352
353 /* Queue entry for GC lists. */
354 TAILQ_ENTRY(pthread) gcle;
355
356 /* Hash queue entry. */
357 LIST_ENTRY(pthread) hle;
358
359 /* Threads reference count. */
360 int refcount;
361
362 /*
363 * Thread start routine, argument, stack pointer and thread
364 * attributes.
365 */
366 void *(*start_routine)(void *);

--- 110 unchanged lines hidden (view full) ---

477 /* Enable event reporting */
478 int report_events;
479
480 /* Event mask */
481 int event_mask;
482
483 /* Event */
484 td_event_msg_t event_buf;
485};
486
487#define THR_SHOULD_GC(thrd) \
488 ((thrd)->refcount == 0 && (thrd)->state == PS_DEAD && \
489 ((thrd)->flags & THR_FLAGS_DETACHED) != 0)
490
491#define THR_IN_CRITICAL(thrd) \
492 (((thrd)->locklevel > 0) || \

--- 21 unchanged lines hidden (view full) ---

514 _thr_umutex_unlock((lck), TID(thrd))
515
516#define THR_LOCK_ACQUIRE(thrd, lck) \
517do { \
518 (thrd)->locklevel++; \
519 _thr_umutex_lock(lck, TID(thrd)); \
520} while (0)
521
522#ifdef _PTHREADS_INVARIANTS
523#define THR_ASSERT_LOCKLEVEL(thrd) \
524do { \
525 if (__predict_false((thrd)->locklevel <= 0)) \
526 _thr_assert_lock_level(); \
527} while (0)
528#else
529#define THR_ASSERT_LOCKLEVEL(thrd)

--- 136 unchanged lines hidden (view full) ---

666extern struct urwlock _thr_list_lock __hidden;
667extern struct umutex _thr_event_lock __hidden;
668
669/*
670 * Function prototype definitions.
671 */
672__BEGIN_DECLS
673int _thr_setthreaded(int) __hidden;
674int _mutex_cv_lock(pthread_mutex_t *, int count) __hidden;
675int _mutex_cv_unlock(pthread_mutex_t *, int *count) __hidden;
676int _mutex_reinit(pthread_mutex_t *) __hidden;
677void _mutex_fork(struct pthread *curthread) __hidden;
678void _libpthread_init(struct pthread *) __hidden;
679struct pthread *_thr_alloc(struct pthread *) __hidden;
680void _thread_exit(const char *, int, const char *) __hidden __dead2;
681int _thr_ref_add(struct pthread *, struct pthread *, int) __hidden;
682void _thr_ref_delete(struct pthread *, struct pthread *) __hidden;
683void _thr_ref_delete_unlocked(struct pthread *, struct pthread *) __hidden;

--- 108 unchanged lines hidden (view full) ---

792
793static inline void
794_thr_check_init(void)
795{
796 if (_thr_initial == NULL)
797 _libpthread_init(NULL);
798}
799
800struct dl_phdr_info;
801void __pthread_cxa_finalize(struct dl_phdr_info *phdr_info);
802void _thr_tsd_unload(struct dl_phdr_info *phdr_info) __hidden;
803void _thr_sigact_unload(struct dl_phdr_info *phdr_info) __hidden;
804
805__END_DECLS
806
807#endif /* !_THR_PRIVATE_H */