The NetBSD Project

CVS log for src/lib/libpthread/pthread.c

[BACK] Up to [cvs.NetBSD.org] / src / lib / libpthread

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.143 / (download) - annotate - [select for diffs], Thu Mar 21 16:49:11 2013 UTC (2 months, 4 weeks ago) by christos
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver, HEAD
Changes since 1.142: +31 -2 lines
Diff to previous 1.142 (colored)

- Allow libpthread to be dlopened again, by providing libc stubs to libpthread.
- Fail if the dlopened libpthread does pthread_create(). From manu@
- Discussed at length in the mailing lists; approved by core@
- This was chosen as the least intrusive patch that will provide
  the necessary functionality.
XXX: pullup to 6

Revision 1.142 / (download) - annotate - [select for diffs], Tue Jan 1 18:42:39 2013 UTC (5 months, 2 weeks ago) by dsl
Branch: MAIN
CVS Tags: yamt-pagecache-base8, tls-maxphys-nbase, tls-maxphys-base
Changes since 1.141: +3 -2 lines
Diff to previous 1.141 (colored)

Don't rely on sys/lwp.h includeing sys/resource.h for us.

Revision 1.141 / (download) - annotate - [select for diffs], Wed Nov 14 23:25:05 2012 UTC (7 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base7
Changes since 1.140: +3 -2 lines
Diff to previous 1.140 (colored)

add argsused

Revision 1.140 / (download) - annotate - [select for diffs], Tue Nov 6 09:03:03 2012 UTC (7 months, 1 week ago) by apb
Branch: MAIN
Changes since 1.139: +4 -4 lines
Diff to previous 1.139 (colored)

Remove duplicate "const" modifier found by clang -Wduplicate-decl-specifier

Revision 1.139 / (download) - annotate - [select for diffs], Sat Nov 3 23:42:27 2012 UTC (7 months, 2 weeks ago) by rmind
Branch: MAIN
Changes since 1.138: +29 -29 lines
Diff to previous 1.138 (colored)

libpthread: replace the use of obsolete sys/tree.h interface with rbtree(9).

Revision 1.138 / (download) - annotate - [select for diffs], Sat Nov 3 03:10:35 2012 UTC (7 months, 2 weeks ago) by christos
Branch: MAIN
Changes since 1.137: +3 -3 lines
Diff to previous 1.137 (colored)

cast return of sysconf

Revision 1.137 / (download) - annotate - [select for diffs], Wed Aug 15 13:28:32 2012 UTC (10 months ago) by drochner
Branch: MAIN
CVS Tags: yamt-pagecache-base6
Branch point for: tls-maxphys
Changes since 1.136: +3 -2 lines
Diff to previous 1.136 (colored)

return errno if pthread_create hits the system limit, not just -1
(this is not entirely correct because it can return ENOMEM which is
not mentioned in the spec, but there are other places in pthread_create
whete ENOMEM is returned -- it at all, this should be fixed everywhere)

Revision 1.136 / (download) - annotate - [select for diffs], Thu Aug 2 12:43:41 2012 UTC (10 months, 2 weeks ago) by joerg
Branch: MAIN
Changes since 1.135: +5 -15 lines
Diff to previous 1.135 (colored)

Prefer sysconf to obtain number of CPUs.

Revision 1.135 / (download) - annotate - [select for diffs], Fri May 4 12:26:33 2012 UTC (13 months, 2 weeks ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base5
Changes since 1.134: +5 -7 lines
Diff to previous 1.134 (colored)

Simplify check for TLS definition to not hide code. Drop it in another
place as it is redundant.

Revision 1.134 / (download) - annotate - [select for diffs], Thu Apr 26 00:21:44 2012 UTC (13 months, 3 weeks ago) by enami
Branch: MAIN
Changes since 1.133: +4 -7 lines
Diff to previous 1.133 (colored)

Store allocated lwpctl state in the thread actually forked,
which is the only thread lives in the child process.

The problem originally reported here:
  https://bugs.ruby-lang.org/issues/6341

Revision 1.133 / (download) - annotate - [select for diffs], Thu Mar 22 20:01:18 2012 UTC (14 months, 4 weeks ago) by drochner
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.132: +4 -3 lines
Diff to previous 1.132 (colored)

don't reuse a dynamically allocated stack if a fixed one is requested

Revision 1.132 / (download) - annotate - [select for diffs], Mon Mar 12 20:16:52 2012 UTC (15 months, 1 week ago) by joerg
Branch: MAIN
Changes since 1.131: +46 -11 lines
Diff to previous 1.131 (colored)

Keep track of the size of the guard area, in case we want to make it
modifiable later. Only reuse the stack if it was allocated by libpthread
and if the expected thread size matches the current stack size.

Revision 1.131 / (download) - annotate - [select for diffs], Mon Mar 12 16:37:15 2012 UTC (15 months, 1 week ago) by joerg
Branch: MAIN
Changes since 1.130: +13 -11 lines
Diff to previous 1.130 (colored)

Further refine stack allocation. If the stack was provided by the user,
don't bother with setting up a guard page. Otherwise, round up the size
to page size. Point stack inside the guarded area, without the guard
page. Fix size when mprotect failed.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Mar 10 18:01:10 2012 UTC (15 months, 1 week ago) by joerg
Branch: MAIN
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored)

Use correct size.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Mar 9 12:06:44 2012 UTC (15 months, 1 week ago) by drochner
Branch: MAIN
Changes since 1.128: +4 -4 lines
Diff to previous 1.128 (colored)

-fix initial stacksize rounding
-minor indentation fix

Revision 1.128 / (download) - annotate - [select for diffs], Thu Mar 8 16:40:45 2012 UTC (15 months, 1 week ago) by joerg
Branch: MAIN
Changes since 1.127: +24 -9 lines
Diff to previous 1.127 (colored)

Actually use the stack thread attributes when creating a new thread.

Revision 1.127 / (download) - annotate - [select for diffs], Thu Mar 8 16:33:45 2012 UTC (15 months, 1 week ago) by joerg
Branch: MAIN
Changes since 1.126: +10 -3 lines
Diff to previous 1.126 (colored)

Fix the stack base pointer for the initial thread on !HPPA.
AT_STACKBASE is pointing to the start of the stack, which is the
upper limit on platforms where the stack grows down.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Mar 2 18:06:05 2012 UTC (15 months, 2 weeks ago) by joerg
Branch: MAIN
Changes since 1.125: +68 -117 lines
Diff to previous 1.125 (colored)

Separate pthread_t from thread stack. Drop additional alignment
restrictions on the thread stack. Remove remaining parts of stackid.

Revision 1.125 / (download) - annotate - [select for diffs], Sun Oct 2 18:18:56 2011 UTC (20 months, 2 weeks ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, netbsd-6-base
Branch point for: yamt-pagecache, netbsd-6
Changes since 1.124: +3 -2 lines
Diff to previous 1.124 (colored)

put back pthread__dbg variable; this is set to no zero by td_open() when
debugging to avoid multiple td_open() mess.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Sep 16 16:05:59 2011 UTC (21 months ago) by joerg
Branch: MAIN
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored)

Use __dead

Revision 1.123 / (download) - annotate - [select for diffs], Wed Mar 30 00:03:26 2011 UTC (2 years, 2 months ago) by joerg
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp
Changes since 1.122: +19 -21 lines
Diff to previous 1.122 (colored)

Rework TLS initialisation:
- Update TCB for the initial thread in pthread__initthread, not
  pthread__init to get it valid as soon as possible.
- Don't overwrite the pt_tls field in pthread__initthread.
- Don't deallocate pt_tls in pthread__scrubthread. This worked more by
  chance than by design.
- Handle freeing the TLS area in pthread_create after removing the
  thread instance from the dead queue.

Revision 1.122 / (download) - annotate - [select for diffs], Sat Mar 12 07:46:29 2011 UTC (2 years, 3 months ago) by matt
Branch: MAIN
Changes since 1.121: +6 -2 lines
Diff to previous 1.121 (colored)

Use __lwp_gettcb_fast if present.

Revision 1.121 / (download) - annotate - [select for diffs], Wed Mar 9 23:10:06 2011 UTC (2 years, 3 months ago) by joerg
Branch: MAIN
Changes since 1.120: +29 -6 lines
Diff to previous 1.120 (colored)

Add TLS support infrastructure. For dynamic binaries, ld.elf_so exports
_rtld_tls_allocate and _rtld_tls_free. libpthread uses this functions to
setup the thread private area of all new threads. ld.elf_so is
responsible for setting up the private area for the initial thread.
Similar functions are called from _libc_init for static binaries, using
dl_iterate_phdr to access the ELF Program Header.

Add test cases to exercise the different TLS storage models. Test cases
are compiled and installed on all platforms, but are skipped on
platforms not marked for TLS support.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.

It is inspired by the TLS support in FreeBSD by Doug Rabson and the
clean ups of the DragonFly port of the original FreeBSD modifications.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Dec 22 22:41:45 2010 UTC (2 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.119: +4 -3 lines
Diff to previous 1.119 (colored)

use pthread__stacksize since size has not been initialized yet.

Revision 1.119 / (download) - annotate - [select for diffs], Wed Dec 22 22:19:46 2010 UTC (2 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.118: +4 -4 lines
Diff to previous 1.118 (colored)

only mprotect base if we moved it.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Dec 18 15:54:27 2010 UTC (2 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.117: +11 -3 lines
Diff to previous 1.117 (colored)

I've had this patch in my tree for a while and since it only improves
the situation, I decided to commit it. There is an inherent problem
with ASLR and the way the pthread library is using the thread stack.

Our pthread library chooses that stack for each thread strategically
so that it can locate the location of the pthread struct for each
thread by masking the stack pointer and looking just below the red
zone it creates. Unfortunately with ASLR you get many random values
for the initial stack, and there are situations where the masked
stack base ends up below the base of the stack. (this happens on
x86 when the stack base happens to be 0x???02000 for example and
your mask is stackmask is 0xffe00000). To fix this, we detect the
pathological cases (this happens only in the main thread), allocate
more stack, and mprotect it appropriately. Then we stash the main
base and the main struct, so that when we look for the pthread
struct in pthread__id, we can special case the main thread.

Another way to work around the problem is unlimiting stacksize,
but the proper way is to use TLS to find the thread structure and
not to play games with the thread stacks.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Nov 14 22:25:23 2010 UTC (2 years, 7 months ago) by tron
Branch: MAIN
Changes since 1.116: +13 -5 lines
Diff to previous 1.116 (colored)

Don't use internal libc function __findenv().

Revision 1.116 / (download) - annotate - [select for diffs], Thu Jul 8 15:13:35 2010 UTC (2 years, 11 months ago) by rmind
Branch: MAIN
Changes since 1.115: +5 -7 lines
Diff to previous 1.115 (colored)

pthread_create: simplify error path slightly.

Revision 1.115 / (download) - annotate - [select for diffs], Thu Mar 25 01:15:00 2010 UTC (3 years, 2 months ago) by explorer
Branch: MAIN
Changes since 1.114: +5 -4 lines
Diff to previous 1.114 (colored)

fix the pthread pt_lid in the fork callback function that runs in the child instead of a function that may be going away.  KNFify

Revision 1.114 / (download) - annotate - [select for diffs], Wed Mar 24 07:27:22 2010 UTC (3 years, 2 months ago) by explorer
Branch: MAIN
Changes since 1.113: +4 -2 lines
Diff to previous 1.113 (colored)

Correctly set pt_lid in the child, after a fork

Revision 1.113 / (download) - annotate - [select for diffs], Sat Oct 3 23:49:50 2009 UTC (3 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.112: +12 -18 lines
Diff to previous 1.112 (colored)

Don't just look only at the first element in the deadqueue to find lwp's
to reuse, because if we lose the race with the kernel we are never going
to reuse any elements. Look in the whole list instead.
XXX: should be pulled up to 5.x

Revision 1.112 / (download) - annotate - [select for diffs], Thu Jul 2 09:59:00 2009 UTC (3 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.111: +2 -7 lines
Diff to previous 1.111 (colored)

Restore use of _lwp_makecontext, the AMD64 bug has been fixed.

Revision 1.111 / (download) - annotate - [select for diffs], Thu Jun 25 13:38:43 2009 UTC (3 years, 11 months ago) by joerg
Branch: MAIN
Changes since 1.110: +7 -2 lines
Diff to previous 1.110 (colored)

Partially revert 1.110: Use makecontext again until the problems with
_lwp_makecontext are solved.

Revision 1.110 / (download) - annotate - [select for diffs], Sun May 17 14:49:00 2009 UTC (4 years, 1 month ago) by ad
Branch: MAIN
Changes since 1.109: +16 -14 lines
Diff to previous 1.109 (colored)

- Convert from makecontext() -> _lwp_makecontext().

- Rely on _lwp_makecontext() to set up the thread identity register.
  This is not currently done (a bug), nor does libpthread use the
  threadreg yet. I'm doing this so it the code can be used by the
  person working on TLS to verify that their threadreg code is working.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Apr 1 10:13:24 2009 UTC (4 years, 2 months ago) by drochner
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base
Changes since 1.108: +9 -3 lines
Diff to previous 1.108 (colored)

Fix the comparision function used by the red-black tree global thread list
implementation:
-don't return a difference, this can overflow
-don't try to substract typed pointers which don't belong to the
 same object, this gives undefined results

This fixes instabilities of programs which use more than a handful
of threads, eg spuriously failing pthread_join().

Revision 1.108 / (download) - annotate - [select for diffs], Mon Mar 30 21:32:51 2009 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.107: +17 -7 lines
Diff to previous 1.107 (colored)

Revert the _lwp_ctl which is causing problem. I did test this locally,
I guess not well enough.

Revision 1.107 / (download) - annotate - [select for diffs], Sun Mar 29 09:30:05 2009 UTC (4 years, 2 months ago) by ad
Branch: MAIN
Changes since 1.106: +13 -29 lines
Diff to previous 1.106 (colored)

- Make the threadreg code use _lwp_setprivate() instead of MD hooks.

  XXX This must not be enabled by default because the LWP private mechanism
  is reserved for TLS. It is provided only as a test/demo.

  XXX Since ucontext_t does not contain the thread private variable, for a
  short time after threads are created their thread specific data is unset.
  If a signal arrives during that time we are screwed.

- No longer need pthread__osrev.

- Rearrange _lwp_ctl() calls slightly.

Revision 1.106 / (download) - annotate - [select for diffs], Wed Oct 8 10:03:28 2008 UTC (4 years, 8 months ago) by ad
Branch: MAIN
CVS Tags: netbsd-5-base, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, matt-mips64-base2, christos-time_t-nbase, christos-time_t-base
Branch point for: netbsd-5, jym-xensuspend, christos-time_t
Changes since 1.105: +3 -3 lines
Diff to previous 1.105 (colored)

Disable diagnostic assertions by default and just return error codes like
other systems. Allows poorly written applications to appear working. If you
are developing pthread apps please turn it on manually by setting the
environment variable.

Revision 1.105 / (download) - annotate - [select for diffs], Sat Aug 2 16:02:26 2008 UTC (4 years, 10 months ago) by matt
Branch: MAIN
CVS Tags: wrstuden-revivesa-base-3, wrstuden-revivesa-base-2
Changes since 1.104: +8 -5 lines
Diff to previous 1.104 (colored)

Change some type to eliminate some lint warnings.

Revision 1.104 / (download) - annotate - [select for diffs], Sat Jun 28 10:36:12 2008 UTC (4 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.103: +4 -4 lines
Diff to previous 1.103 (colored)

Minor correction to previous.

Revision 1.103 / (download) - annotate - [select for diffs], Sat Jun 28 10:29:37 2008 UTC (4 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.102: +27 -3 lines
Diff to previous 1.102 (colored)

Now that we have all the scheduling gunk, make these do something useful:

pthread_attr_get_np
pthread_attr_setschedparam
pthread_attr_getschedparam
pthread_attr_setschedpolicy
pthread_attr_getschedpolicy

Revision 1.102 / (download) - annotate - [select for diffs], Wed Jun 25 11:06:34 2008 UTC (4 years, 11 months ago) by ad
Branch: MAIN
Changes since 1.101: +3 -2 lines
Diff to previous 1.101 (colored)

pthread_join: explicitly test for cancellation.

Revision 1.101 / (download) - annotate - [select for diffs], Sun May 25 17:05:28 2008 UTC (5 years ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.100: +67 -151 lines
Diff to previous 1.100 (colored)

PR lib/38741 priority inversion in libpthread breaks apps that use
SCHED_FIFO threads

- Change condvar sync so that we never take the condvar's spinlock without
  first holding the caller-provided mutex. Previously, the spinlock was only
  taken without the mutex in an error path, but it was enough to trigger the
  problem described in the PR.

- Even with this change, applications calling pthread_cond_signal/broadcast
  without holding the interlocking mutex are still subject to the problem
  described in the PR. POSIX discourages this saying that it leads to
  undefined scheduling behaviour, which seems good enough for the time being.

- Elsewhere, use a hash of mutexes instead of per-object spinlocks to
  synchronize entry/exit from sleep queues.

- Simplify how sleep queues are maintained.

Revision 1.100 / (download) - annotate - [select for diffs], Mon Apr 28 20:23:01 2008 UTC (5 years, 1 month ago) by martin
Branch: MAIN
CVS Tags: yamt-pf42-base2, hpcarm-cleanup-nbase
Branch point for: wrstuden-revivesa
Changes since 1.99: +2 -9 lines
Diff to previous 1.99 (colored)

Remove clause 3 and 4 from TNF licenses

Revision 1.99 / (download) - annotate - [select for diffs], Sat Mar 22 14:19:27 2008 UTC (5 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base
Branch point for: yamt-pf42
Changes since 1.98: +12 -2 lines
Diff to previous 1.98 (colored)

Back out previous. It seems to expose another bug in libpthread/libc,
potentially errno being used before threading is up and running.

Revision 1.98 / (download) - annotate - [select for diffs], Fri Mar 21 21:35:43 2008 UTC (5 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.97: +2 -12 lines
Diff to previous 1.97 (colored)

Move pthread__errno() into pthread_specific.c so it gets the "no stack
frame" treatment.

Revision 1.97 / (download) - annotate - [select for diffs], Sat Mar 8 13:23:13 2008 UTC (5 years, 3 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-nbase, keiichi-mipv6-base
Changes since 1.96: +12 -6 lines
Diff to previous 1.96 (colored)

Complain if _lwp_ctl() fails.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Jan 8 20:56:08 2008 UTC (5 years, 5 months ago) by christos
Branch: MAIN
CVS Tags: hpcarm-cleanup-base
Branch point for: keiichi-mipv6
Changes since 1.95: +4 -2 lines
Diff to previous 1.95 (colored)

add missing static decls.

Revision 1.95 / (download) - annotate - [select for diffs], Mon Dec 24 16:04:20 2007 UTC (5 years, 5 months ago) by ad
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.94: +6 -13 lines
Diff to previous 1.94 (colored)

- Use pthread__cancelled() in more places.
- pthread_join(): assert that pthread_cond_wait() returns zero.

Revision 1.94 / (download) - annotate - [select for diffs], Mon Dec 24 14:46:28 2007 UTC (5 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.93: +110 -68 lines
Diff to previous 1.93 (colored)

- Fix pthread_rwlock_trywrlock() which was broken.

- Add new functions: pthread_mutex_held_np, mutex_owner_np, rwlock_held_np,
  rwlock_wrheld_np, rwlock_rdheld_np. These match the kernel's locking
  primitives and can be used when porting kernel code to userspace.

- Always create LWPs detached. Do join/exit sync mostly in userland. When
  looped on a dual core box this seems ~30% quicker than using lwp_wait().
  Reduce number of lock acquire/release ops during thread exit.

Revision 1.93 / (download) - annotate - [select for diffs], Tue Dec 11 03:21:30 2007 UTC (5 years, 6 months ago) by ad
Branch: MAIN
CVS Tags: cube-autoconf-base, cube-autoconf
Changes since 1.92: +2 -15 lines
Diff to previous 1.92 (colored)

Remove test of pthread__osrev that is no longer needed.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Dec 4 16:08:28 2007 UTC (5 years, 6 months ago) by yamt
Branch: MAIN
Changes since 1.91: +3 -3 lines
Diff to previous 1.91 (colored)

remove unnecessary assignments.

Revision 1.91 / (download) - annotate - [select for diffs], Sat Dec 1 01:07:34 2007 UTC (5 years, 6 months ago) by ad
Branch: MAIN
Changes since 1.90: +6 -19 lines
Diff to previous 1.90 (colored)

- On 64-bit platforms 1/2 the default tsd values were garbage. Fix it.
- The lwpctl block is now needed on uniprocessors, for pthread_curcpu_np().

Revision 1.90 / (download) - annotate - [select for diffs], Mon Nov 19 15:14:12 2007 UTC (5 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.89: +2 -5 lines
Diff to previous 1.89 (colored)

Remove the debuglog stuff. ktrace is more useful now.

Revision 1.89 / (download) - annotate - [select for diffs], Wed Nov 14 19:28:23 2007 UTC (5 years, 7 months ago) by drochner
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored)

Add pthread_equal() to libc stubs; this makes a lot of sense for
threadsafe libraries implementing own locking functions.
Ride on yesterday's minor version bumps.

Revision 1.88 / (download) - annotate - [select for diffs], Tue Nov 13 17:20:09 2007 UTC (5 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.87: +64 -13 lines
Diff to previous 1.87 (colored)

Mutexes:

- Play scrooge again and chop more cycles off acquire/release.
- Spin while the lock holder is running on another CPU (adaptive mutexes).
- Do non-atomic release.

Threadreg:

- Add the necessary hooks to use a thread register.
- Add the code for i386, using %gs.
- Leave i386 code disabled until xen and COMPAT_NETBSD32 have the changes.

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 13 15:57:10 2007 UTC (5 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.86: +32 -62 lines
Diff to previous 1.86 (colored)

For PR bin/37347:

- Override __libc_thr_init() instead of using our own constructor.
- Add pthread__getenv() and use instead of getenv(). This is used before
  we are up and running and unfortunatley getenv() takes locks.

Other changes:

- Cache the spinlock vectors in pthread__st. Internal spinlock operations
  now take 1 function call instead of 3 (i386).
- Use pthread__self() internally, not pthread_self().
- Use __attribute__ ((visibility("hidden"))) in some places.
- Kill PTHREAD_MAIN_DEBUG.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Nov 7 00:55:22 2007 UTC (5 years, 7 months ago) by ad
Branch: MAIN
Changes since 1.85: +16 -4 lines
Diff to previous 1.85 (colored)

Use _lwp_setname() to pass thread names to the kernel.

Revision 1.85 / (download) - annotate - [select for diffs], Tue Oct 16 15:07:02 2007 UTC (5 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.84: +6 -2 lines
Diff to previous 1.84 (colored)

... but preserve the linked list, for the debugger only.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Oct 16 13:41:18 2007 UTC (5 years, 8 months ago) by ad
Branch: MAIN
Changes since 1.83: +31 -15 lines
Diff to previous 1.83 (colored)

Replace the global thread list with a red-black tree. From joerg@.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Sep 11 18:08:10 2007 UTC (5 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored)

Put new threads on the tail of pthread__allqueue, for the debugger.

Revision 1.82 / (download) - annotate - [select for diffs], Sat Sep 8 22:49:50 2007 UTC (5 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base5
Changes since 1.81: +46 -42 lines
Diff to previous 1.81 (colored)

- Get rid of self->pt_mutexhint and use pthread__mutex_owned() instead.
- Update some comments and fix minor bugs. Minor cosmetic changes.
- Replace some spinlocks with mutexes and rwlocks.
- Change the process private semaphores to use mutexes and condition
  variables instead of doing the synchronization directly. Spinlocks
  are no longer used by the semaphore code.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Sep 7 14:09:27 2007 UTC (5 years, 9 months ago) by ad
Branch: MAIN
Changes since 1.80: +46 -30 lines
Diff to previous 1.80 (colored)

- Don't take the mutex's spinlock (ptr_interlock) in pthread_cond_wait().
  Instead, make the deferred wakeup list a per-thread array and pass down
  the lwpid_t's that way.

- In pthread_cond_wait(), take the mutex before dealing with early wakeup.
  In this way there should never be contention on the CV's spinlock if
  the app follows POSIX rules (there should only be contention on the
  user-provided mutex).

- Add a port of the kernel's rwlocks. The rwlock's spinlock is only taken if
  there is contention. This is enabled where atomic ops are available. Right
  now that is only i386 and amd64 because I don't have other hardware to
  test with. It's trivial to add stubs for other architectures as long as
  they have compare-and-swap. When we have proper atomic ops the old rwlock
  code can be removed.

- Add a new mutex implementation that's similar to the kernel's mutexes, but
  uses compare-and-swap to maintain the waiters list, so no spinlocks are
  involved. Same caveats apply as for the rwlocks.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Aug 23 19:13:23 2007 UTC (5 years, 9 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base4
Branch point for: matt-armv6
Changes since 1.79: +4 -4 lines
Diff to previous 1.79 (colored)

Acquire the correct lock in pthread_detach(). Spotted by Jan Kryl.

Revision 1.79 / (download) - annotate - [select for diffs], Fri Aug 17 14:28:31 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base3
Changes since 1.78: +13 -5 lines
Diff to previous 1.78 (colored)

pthread_suspend_np, pthread_resume_np, pthread_detach: return correct code
on error.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Aug 16 13:54:16 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.77: +59 -78 lines
Diff to previous 1.77 (colored)

Trim fat off libpthread internal spinlock operations. Makes a mesurable
improvement across the board.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Aug 16 12:01:49 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.76: +67 -72 lines
Diff to previous 1.76 (colored)

- Reinitialize the absolute minimum when recycling user thread state.
  Chops another ~10% off create/join in a loop on i386.
- Disable low level debugging as this is stable. Improves benchmarks
  across the board by a small percentage. Uncontested mutex acquire
  and release in a loop becomes about 8% quicker.
- Minor cleanup.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Aug 16 01:09:34 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.75: +135 -5 lines
Diff to previous 1.75 (colored)

Remove PT_FIXEDSTACKSIZE_LG.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Aug 16 00:41:23 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.74: +20 -24 lines
Diff to previous 1.74 (colored)

Cache thread context for creation instead of setting it up every time.
Speeds create/join loop by about 10-15% on i386.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Aug 15 22:48:52 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.73: +36 -41 lines
Diff to previous 1.73 (colored)

Simplify pthread_join(). Knocks about 5% off pthread_create/join in a loop.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Aug 7 19:58:30 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base2
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

Missed variable rename..

Revision 1.72 / (download) - annotate - [select for diffs], Tue Aug 7 19:04:21 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.71: +74 -12 lines
Diff to previous 1.71 (colored)

Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.

Revision 1.71 / (download) - annotate - [select for diffs], Sat Aug 4 18:54:12 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
CVS Tags: matt-mips64-base
Branch point for: matt-mips64
Changes since 1.70: +3 -2 lines
Diff to previous 1.70 (colored)

Make libpthread_dbg build again.

Revision 1.70 / (download) - annotate - [select for diffs], Sat Aug 4 13:43:46 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.69: +21 -15 lines
Diff to previous 1.69 (colored)

Fix error in previous.

Revision 1.69 / (download) - annotate - [select for diffs], Sat Aug 4 13:37:48 2007 UTC (5 years, 10 months ago) by ad
Branch: MAIN
Changes since 1.68: +134 -150 lines
Diff to previous 1.68 (colored)

Some significant performance improvements, and a fix for a race with pthread
detach/join.

- Make mutex acquire spin for a short time, as done with spinlocks.
- Make the number of spins controllable with the env var PTHREAD_NSPINS.
- Reduce the amount of time that libpthread internal spinlocks are held.
- Rely more on the barrier effects of park/unpark to avoid taking spinlocks.
- Simplify the locking around pthreads and the global queues.
- Align per-thread sync data on a 128 byte boundary.
- Offset thread stacks by a small amount to try and reduce cache thrash.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Mar 24 18:51:59 2007 UTC (6 years, 2 months ago) by ad
Branch: MAIN
CVS Tags: nick-csl-alignment-base, hpcarm-cleanup
Branch point for: nick-csl-alignment
Changes since 1.67: +5 -4 lines
Diff to previous 1.67 (colored)

- Test+branch is usually cheaper than making an indirect function call,
  so avoid making them.
- When parking an LWP on a condition variable, point the hint argument at
  the mutex's waiters queue. Chances are we will be awoken from that later.

Revision 1.67 / (download) - annotate - [select for diffs], Wed Mar 14 23:33:42 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.66: +34 -24 lines
Diff to previous 1.66 (colored)

- pthread__park: always check for cancellation.
- pthread__unpark: cosmetic changes.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Mar 5 23:55:40 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.65: +25 -34 lines
Diff to previous 1.65 (colored)

- Simplify the interface to pthread__park() and friends slightly.
- If sysctl() fails, complain.

Revision 1.65 / (download) - annotate - [select for diffs], Fri Mar 2 18:58:45 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.64: +4 -4 lines
Diff to previous 1.64 (colored)

Silence a gcc/lint warning.

Revision 1.64 / (download) - annotate - [select for diffs], Fri Mar 2 18:53:51 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.63: +4 -410 lines
Diff to previous 1.63 (colored)

Remove the PTHREAD_SA option. If M:N threads is reimplemented it's
better off done with a seperate library.

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 2 17:40:55 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.62: +5 -3 lines
Diff to previous 1.62 (colored)

pthread_detach: acquire the join lock before changing pt_flags.

Revision 1.62 / (download) - annotate - [select for diffs], Wed Feb 21 22:31:38 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.61: +5 -4 lines
Diff to previous 1.61 (colored)

- Put detached & exiting threads on the tail of the deadqueue, not head.
- Don't forget to set PT_FLAG_DETACHED.

Revision 1.61 / (download) - annotate - [select for diffs], Wed Feb 21 22:25:57 2007 UTC (6 years, 3 months ago) by ad
Branch: MAIN
Changes since 1.60: +4 -3 lines
Diff to previous 1.60 (colored)

Minor optimisation to previous: only check for continued existence of
the thread if it was detached.

Revision 1.60 / (download) - annotate - [select for diffs], Thu Feb 15 15:39:38 2007 UTC (6 years, 4 months ago) by yamt
Branch: MAIN
Changes since 1.59: +13 -9 lines
Diff to previous 1.59 (colored)

fix a race between pthread_exit and pthread_create.
inefficient, but better than crashing.

Revision 1.59 / (download) - annotate - [select for diffs], Fri Feb 9 23:53:24 2007 UTC (6 years, 4 months ago) by ad
Branch: MAIN
Changes since 1.58: +5 -3 lines
Diff to previous 1.58 (colored)

Cast the return value of _lwp_unpark_all(), just in case.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jan 31 23:55:20 2007 UTC (6 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.57: +3 -3 lines
Diff to previous 1.57 (colored)

use __func__ instead of __FUNCTION__ which is a gcc extension.

Revision 1.57 / (download) - annotate - [select for diffs], Sat Jan 20 20:02:36 2007 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored)

pthread_create(): clear newthread->pt_sleeponq before calling _lwp_create().

Revision 1.56 / (download) - annotate - [select for diffs], Sat Jan 20 04:56:07 2007 UTC (6 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.55: +3 -3 lines
Diff to previous 1.55 (colored)

add a missing volatile.

Revision 1.55 / (download) - annotate - [select for diffs], Tue Jan 16 05:22:55 2007 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.54: +3 -2 lines
Diff to previous 1.54 (colored)

Fix a race between pthread_exit() and pthread_join().

Revision 1.54 / (download) - annotate - [select for diffs], Tue Jan 16 04:19:02 2007 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.53: +16 -10 lines
Diff to previous 1.53 (colored)

Fix a race between pthread_create() and pthread_exit() in the 1:1 case.

Revision 1.53 / (download) - annotate - [select for diffs], Tue Jan 16 01:35:16 2007 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.52: +8 -7 lines
Diff to previous 1.52 (colored)

Pass in the 'hint' argument when parking/unparking LWPs.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Dec 24 18:39:45 2006 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.51: +142 -58 lines
Diff to previous 1.51 (colored)

Fix bugs with and improve upon previous.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Dec 23 09:48:18 2006 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.50: +9 -2 lines
Diff to previous 1.50 (colored)

Add another comment.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Dec 23 05:18:56 2006 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.49: +4 -2 lines
Diff to previous 1.49 (colored)

Add a comment.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Dec 23 05:14:46 2006 UTC (6 years, 5 months ago) by ad
Branch: MAIN
Changes since 1.48: +279 -17 lines
Diff to previous 1.48 (colored)

Conditionalised support for 1:1 threads. Needs associated kernel changes
and more work to be useful.

Revision 1.48 / (download) - annotate - [select for diffs], Mon Apr 24 18:39:36 2006 UTC (7 years, 1 month ago) by drochner
Branch: MAIN
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, netbsd-4-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0, abandoned-netbsd-4-base, abandoned-netbsd-4
Branch point for: wrstuden-fixsa, netbsd-4
Changes since 1.47: +5 -3 lines
Diff to previous 1.47 (colored)

There is no point in using the internal sigprocmask() to initialize
the process' signal mask -- this ends up in a no-op.
Use the system call directly instead.
(This might be done in pthread_sig.c, but for now I wanted a simple
patch which is easily tested and pulled up.)

Revision 1.47 / (download) - annotate - [select for diffs], Sun Feb 12 11:41:53 2006 UTC (7 years, 4 months ago) by yamt
Branch: MAIN
Changes since 1.46: +2 -8 lines
Diff to previous 1.46 (colored)

- do PTHREAD_MLOCK_KLUDGE in pthread__stackid_setup, rather than callers,
  so that the main thread is not different from others.
  as a side effect, fix memory leak in pthread_create on error.
- make pthread__stackid_setup return a error rather than calling err(2).

Revision 1.46 / (download) - annotate - [select for diffs], Wed Oct 19 02:44:45 2005 UTC (7 years, 8 months ago) by chs
Branch: MAIN
Changes since 1.45: +5 -3 lines
Diff to previous 1.45 (colored)

if mlock() fails in pthread_create(), return EAGAIN instead of
failing an assertion.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Oct 19 02:15:03 2005 UTC (7 years, 8 months ago) by chs
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

starting the pthread library (ie. calling pthread__start()) before
any threads are created turned out to be not such a good idea.
there are stronger requirements on what has to work in a forked child
while a process is still single-threaded.  so take all that stuff
back out and fix the problems with single-threaded programs that
are linked with libpthread differently, by checking if the library
has been started and doing completely different stuff if it hasn't been:
 - for pthread_rwlock_timedrdlock(), just fail with EDEADLK immediately.
 - for sem_wait(), the only thing that can unlock the semaphore is a
   signal handler, so use sigsuspend() to wait for a signal.
 - for pthread_mutex_lock_slow(), just go into an infinite loop
   waiting for signals.

I also noticed that there's a "sem2" test that has never worked in its
single-threaded form.  the problem there is that a signal handler tries
to take a sem_t interlock which is already held when the signal is received.
fix this too, by adding a single-threaded case for sig_trywait() that
blocks signals instead of using the userland interlock.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Oct 16 00:37:52 2005 UTC (7 years, 8 months ago) by chs
Branch: MAIN
Changes since 1.43: +32 -10 lines
Diff to previous 1.43 (colored)

in pthread_kill() and pthread_suspend_np(), return without doing anything
if the target thread is a zombie.

in all the functions that didn't do so already, verify a pthread_t before
dereferencing it (under #ifdef ERRORCHECK, since these checks are not
mandated by the standard).

clean up some debugging stuff.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Oct 16 00:07:24 2005 UTC (7 years, 8 months ago) by chs
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (colored)

in pthread_mutex_lock_slow(), pthread_rwlock_timedrdlock() and sem_wait(),
call pthread__start() if it hasn't already been called.  this avoids
an internal assertion from the library if these routines are used
before any threads are created and they need to sleep.
fixes PR 20256, PR 24241, PR 25722, PR 26096.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Jul 1 12:35:18 2005 UTC (7 years, 11 months ago) by yamt
Branch: MAIN
Changes since 1.41: +2 -4 lines
Diff to previous 1.41 (colored)

make this compile without PTHREAD_MLOCK_KLUDGE.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Feb 26 20:33:06 2005 UTC (8 years, 3 months ago) by nathanw
Branch: MAIN
CVS Tags: netbsd-3-base
Branch point for: netbsd-3
Changes since 1.40: +4 -2 lines
Diff to previous 1.40 (colored)

Keep the kernel updated with signal action signal masks (act.sa_mask) until
threads are started, since before that the traditional signal invocation
method will be used. Fixes regress/lib/libpthread/sigmask2.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Feb 10 23:42:37 2005 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.39: +3 -3 lines
Diff to previous 1.39 (colored)

Default back pthread__concurrency to 1 until we fix the regression test
related to pthread_kill().

Revision 1.39 / (download) - annotate - [select for diffs], Thu Feb 10 02:20:49 2005 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.38: +4 -5 lines
Diff to previous 1.38 (colored)

If $PTHREAD_CONCURRENCY is not set, set it to ncpu

Revision 1.38 / (download) - annotate - [select for diffs], Thu Feb 3 17:30:33 2005 UTC (8 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.37: +18 -2 lines
Diff to previous 1.37 (colored)

Add charles' mlock fixes, protected with PTHREAD_MLOCK_KLUDGE and enabled
by default, until we come up with a real fix.

Revision 1.37 / (download) - annotate - [select for diffs], Thu Jan 6 17:38:29 2005 UTC (8 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.36: +4 -2 lines
Diff to previous 1.36 (colored)

Add some additional assertions and debugging printf()s.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Aug 12 10:54:13 2004 UTC (8 years, 10 months ago) by yamt
Branch: MAIN
Changes since 1.35: +49 -16 lines
Diff to previous 1.35 (colored)

- fix pthread_detach with an already exit'ed thread.
  namely, put the thread to deadqueue rather than just leaking it.
- fix a race between pthread_detach/join and pthread_exit,
  which also causes dead thread leaks.

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jul 18 21:24:52 2004 UTC (8 years, 11 months ago) by chs
Branch: MAIN
Changes since 1.34: +7 -7 lines
Diff to previous 1.34 (colored)

enhance MI pthreads code to support hppa:
 - statically initialize all global spin locks.  on hppa, 0 means
   the lock is held, so leaving them with the default value doesn't work.
 - compare functions pointers using a function-pointer type rather than
   an integral type.  on hppa, function pointers may be indirect,
   so we need to trigger gcc to emit calls to the function-pointer
   canonicalization routines in the millicode.
 - on hppa the stack grows up, so handle that using the STACK_* macros.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Jun 25 16:33:32 2004 UTC (8 years, 11 months ago) by drochner
Branch: MAIN
Changes since 1.33: +6 -4 lines
Diff to previous 1.33 (colored)

const'ify the arguments to pthread__assertfunc and _errorfunc;
needed because the __func__ pseudo-var is strictly "const*" in gcc-3.4

Revision 1.33 / (download) - annotate - [select for diffs], Sun Mar 14 01:19:41 2004 UTC (9 years, 3 months ago) by cl
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.32: +43 -8 lines
Diff to previous 1.32 (colored)

add libpthread part of concurrency support for SA on MP systems
- enable concurrency according to environment variable PTHREAD_CONCURRENCY
- add idle VP wakeup if there are additional jobs and idle VPs
- make reidlequeue per VP
- enable spinning for locks
- fix race condition in alarm processing
- fix race condition in mutex locking
- make debugging output line buffered and add VP prefix to debug lines

Revision 1.32 / (download) - annotate - [select for diffs], Wed Dec 31 16:45:48 2003 UTC (9 years, 5 months ago) by cl
Branch: MAIN
Changes since 1.31: +10 -10 lines
Diff to previous 1.31 (colored)

Handle block/unblock for threads in critical section without
sa_unblockyield.

XXX g/c sa_unblockyield in kernel later

Revision 1.31 / (download) - annotate - [select for diffs], Thu Dec 18 15:39:56 2003 UTC (9 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.30: +6 -3 lines
Diff to previous 1.30 (colored)

PR/23791: Patrick Latify: Fix memory leak on thread creation failure.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Nov 9 18:56:48 2003 UTC (9 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.29: +71 -4 lines
Diff to previous 1.29 (colored)

Add:

int    pthread_attr_setcreatesuspend_np(pthread_attr_t *);
int    pthread_suspend_np(pthread_t);
int    pthread_resume_np(pthread_t);

needed for java. Approved and fixed by cl.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Aug 13 18:52:01 2003 UTC (9 years, 10 months ago) by nathanw
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

Split out pthread_{set,get}specific() into a separate file and arrange
for that file to not be built with profiling. This makes it reasonable to
use pthread_{set,get}specific() to implement thread-safe profiline call counts.

Revision 1.28 / (download) - annotate - [select for diffs], Mon Jul 21 22:24:09 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.27: +59 -39 lines
Diff to previous 1.27 (colored)

Lock accesses to pt_flags and pt_cancel.

When disabling cancellation, clear the pt_cancel flag if it was set
and note the cancellation request with PT_FLAG_CS_PENDING. This avoids
a problem where a cancellation request entered but not acted upon before
pthread_setcanclstate(PTHREAD_CANCEL_DISABLE) is called would still be
aceted upon before cancellation was re-enabled.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jul 21 22:17:14 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.26: +6 -4 lines
Diff to previous 1.26 (colored)

Use _sys_write() instead of write() in the assertion and error
functions, to avoid invoking the cancellation machinery in the middle
of trying to print an assertion or error message.

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jul 21 22:14:57 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

Move initialization of variable 'nthreads' so that pthread_exit() from
the main thread, with no other threads created, exits cleanly instead
of triggering an assertion in pthread_next().

Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 18 22:33:45 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.24: +3 -359 lines
Diff to previous 1.24 (colored)

pthread.c was getting a bit unwieldly. Move pthread_attr stuff out
into a new file, and put the shared private structure definition in
pthread_int.h.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Jul 18 22:12:30 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.23: +240 -53 lines
Diff to previous 1.23 (colored)

Implement a bunch of pthread_attr_() functions, which genuinely set and examine
pthread_attr_t objects, although most of the properties being set don't really
affect threads yet:

pthread_attr_{get,set}guardsize()
pthread_attr_{get,set}inheritsched()
pthread_attr_{get,set}scope()
pthread_attr_{get,set}stack()
pthread_attr_setstack{size,addr}()

Remove some useless assertions and error checks in the existing pthread_attr()
routines.

Implement pthread_attr_get_np(), to examine the attributes of an existing
thread. Idea and interface from FreeBSD.

Change PTHREAD_ERRORMODE environment variable to PTHREAD_DIAGASSERT, and
make it behave like libc's LIBC_DIAGASSERT. The way to disable error-checking
and aborting is now "PTHREAD_DIAGASSERT=AEL", rather than
"PTHREAD_ERRORMODE=ignore".

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jul 18 21:57:26 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.22: +3 -2 lines
Diff to previous 1.22 (colored)

Add strong alias for setcancelstate.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Jun 26 01:30:39 2003 UTC (9 years, 11 months ago) by nathanw
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

Initialize pt_trapuc in pthread__initthread().

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 6 21:06:07 2003 UTC (10 years ago) by nathanw
Branch: MAIN
Changes since 1.20: +5 -2 lines
Diff to previous 1.20 (colored)

Tiny bit of infrastructure for ABI-supported thread-ID storage.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jun 2 16:59:26 2003 UTC (10 years ago) by christos
Branch: MAIN
Changes since 1.19: +30 -2 lines
Diff to previous 1.19 (colored)

Add pthread_attr_getstack{,size,addr} needed by jdk

Revision 1.19 / (download) - annotate - [select for diffs], Tue May 27 15:24:24 2003 UTC (10 years ago) by christos
Branch: MAIN
Changes since 1.18: +9 -10 lines
Diff to previous 1.18 (colored)

pass lint:
1. add new pthread__abort() and change pthread_assert(0) to it.
2. put constcond in the right place (in the macro).
3. no space after pthread__assert macro.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Apr 28 17:46:30 2003 UTC (10 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.17: +9 -3 lines
Diff to previous 1.17 (colored)

Move call to pthread__alarm_init() from pthread_init() (called at load
time) to pthread__start() (called on the first call of
pthread_create()), so that there's no opportunity for a fork() to
clear the per-process timer.

Problem pointed out by a test program from Mihai CHELARU on
current-users.

Revision 1.17 / (download) - annotate - [select for diffs], Wed Apr 23 19:35:47 2003 UTC (10 years, 1 month ago) by nathanw
Branch: MAIN
Changes since 1.16: +49 -2 lines
Diff to previous 1.16 (colored)

Introduce a pthread__error() macro, for detected application errors as
opposed to internal errors. The setting of the PTHREAD_ERRORMODE
environment variable determines the runtime behavior. Valid settings
are "ignore", "abort", and "print". The default is currently "abort".

Revision 1.16 / (download) - annotate - [select for diffs], Mon Apr 7 21:29:48 2003 UTC (10 years, 2 months ago) by nathanw
Branch: MAIN
Changes since 1.15: +18 -2 lines
Diff to previous 1.15 (colored)

When threads are started, register an atfork callback to clear
pthread__started in the child process. This lets sleep() work in the
child, as required by POSIX.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 10 22:16:37 2003 UTC (10 years, 3 months ago) by nathanw
Branch: MAIN
Changes since 1.14: +2 -6 lines
Diff to previous 1.14 (colored)

Re-enable nanosleep(); kernel bug is squished (kern_time.c:1.67).

Revision 1.14 / (download) - annotate - [select for diffs], Sat Mar 8 08:03:34 2003 UTC (10 years, 3 months ago) by lukem
Branch: MAIN
Changes since 1.13: +4 -3 lines
Diff to previous 1.13 (colored)

add __RCSID()

Revision 1.13 / (download) - annotate - [select for diffs], Fri Feb 28 18:37:44 2003 UTC (10 years, 3 months ago) by nathanw
Branch: MAIN
Changes since 1.12: +5 -1 lines
Diff to previous 1.12 (colored)

Disable userlevel nanosleep() until I find the timer/alarm bug that it
is tickling.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Feb 26 23:41:01 2003 UTC (10 years, 3 months ago) by nathanw
Branch: MAIN
Changes since 1.11: +5 -7 lines
Diff to previous 1.11 (colored)

In pthread_create(), rearrange name-setting code so that name is set
to NULL when the attribute structure does not have a private field
allocated.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Feb 26 22:02:48 2003 UTC (10 years, 3 months ago) by thorpej
Branch: MAIN
Changes since 1.10: +171 -5 lines
Diff to previous 1.10 (colored)

Add support for naming a thread, using an API compatible with Tru64 Unix:
* pthread_attr_getname_np()
* pthread_attr_setname_np()
* pthread_getname_np()
* pthread_setname_np()

In addition to being query'able by the application (for log messages, etc.),
it is intended that these names can show up in the debugger.

Reviewed by nathanw.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Feb 22 00:53:29 2003 UTC (10 years, 3 months ago) by nathanw
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

In pthread_exit(), clear pt_canceled in addition to setting
PT_FLAG_CS_DISABLED in pt_flags.

Prevents cancellation cleanup handlers from thinking that they've been
canceled and exiting mid-handler. Problem spotted by Matt Thomas.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Feb 15 04:34:40 2003 UTC (10 years, 4 months ago) by nathanw
Branch: MAIN
Changes since 1.8: +37 -11 lines
Diff to previous 1.8 (colored)

Define a pthread-specific assert function, pthread__assert(), that
bails out without trying to flush stdio buffers.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jan 31 04:59:40 2003 UTC (10 years, 4 months ago) by nathanw
Branch: MAIN
Changes since 1.7: +7 -8 lines
Diff to previous 1.7 (colored)

Use pthread__sched_sleepers() instead of iterating over sleep queues
ourself.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jan 29 14:03:08 2003 UTC (10 years, 4 months ago) by drochner
Branch: MAIN
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

cosmetics

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jan 25 00:37:01 2003 UTC (10 years, 4 months ago) by nathanw
Branch: MAIN
Changes since 1.5: +16 -10 lines
Diff to previous 1.5 (colored)

Make pthread_join() accomodate spurious wakeups from pthread__block().

Revision 1.5 / (download) - annotate - [select for diffs], Sun Jan 19 21:58:24 2003 UTC (10 years, 5 months ago) by thorpej
Branch: MAIN
Changes since 1.4: +3 -1 lines
Diff to previous 1.4 (colored)

Add some threadlib stubs that are used by X:
* thr_create() (stub in libc aborts)
* thr_exit() (stub in libc calls exit())
* thr_yield() (stub in libc does nothing)

Also make the libc thr_self() stub not abort.

XXX Should we add thrattr_*() stubs for setting the detach-state?

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jan 19 16:03:50 2003 UTC (10 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.3: +4 -3 lines
Diff to previous 1.3 (colored)

- constify the get functions
- remove argument variable names since they pollute the namespace
- add mock implementation of the missing stack functions
XXX: we need to do this right [i.e. actually get and set sizes and addresses]
but the current stack setup makes this a bit complicated.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jan 18 18:45:52 2003 UTC (10 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (colored)

de-lint

Revision 1.2 / (download) - annotate - [select for diffs], Sat Jan 18 10:34:15 2003 UTC (10 years, 5 months ago) by thorpej
Branch: MAIN
Changes since 1.1: +835 -0 lines
Diff to previous 1.1 (colored)

Merge the nathanw_sa branch.

Revision 1.1, Mon Mar 5 23:51:54 2001 UTC (12 years, 3 months ago) by nathanw
Branch: MAIN
CVS Tags: nathanw_sa_before_merge
Branch point for: nathanw_sa
FILE REMOVED

file pthread.c was initially added on branch nathanw_sa.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>