Skip site navigation (1)Skip section navigation (2)

CVS log for src/lib/libc_r/uthread/Attic/uthread_select.c

[BACK] Up to [FreeBSD] / src / lib / libc_r / uthread

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.23.14.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 3 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.23.10.1.6.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 3 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.23.10.1: preferred, colored; next MAIN 1.23.12.1: preferred, colored
Changes since revision 1.23.10.1: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.24
Sat Nov 13 22:22:18 2010 UTC (14 months, 4 weeks ago) by emaste
Branches: MAIN
CVS tags: HEAD
FILE REMOVED
Changes since revision 1.23: +1 -1 lines
SVN rev 215269 on 2010-11-13 22:22:18Z by emaste

Remove libc_r threading library.  It has been disconnected from the build
for four years (since r162846).

Submitted by: Alexander Best arundel@

Revision 1.23.10.1.4.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 4 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.23.10.1: preferred, colored; next MAIN 1.23.12.1: preferred, colored
Changes since revision 1.23.10.1: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.23.12.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (2 years ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.23.10.1.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.23.10.1: preferred, colored; next MAIN 1.23.12.1: preferred, colored
Changes since revision 1.23.10.1: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.23.10.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
CVS tags: RELENG_8_2_BP, RELENG_8_1_BP, RELENG_8_0_BP
Branch point for: RELENG_8_2, RELENG_8_1, RELENG_8_0
Diff to: previous 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.23.8.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.23.6.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.23: preferred, colored; next MAIN 1.24: preferred, colored
Changes since revision 1.23: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.21.14.1.6.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.21.14.1: preferred, colored; next MAIN 1.22: preferred, colored
Changes since revision 1.21.14.1: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.23: download - view: text, markup, annotated - select for diffs
Fri Jan 12 07:25:26 2007 UTC (5 years, 1 month ago) by imp
Branches: MAIN
CVS tags: RELENG_8_BP, RELENG_7_BP, RELENG_7_4_BP, RELENG_7_3_BP, RELENG_7_2_BP, RELENG_7_1_BP, RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0, RELENG_7
Branch point for: RELENG_8, RELENG_7_4, RELENG_7_3, RELENG_7_2, RELENG_7_1
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -4 lines
Remove 3rd clause, renumber, ok per email

Revision 1.16.2.6: download - view: text, markup, annotated - select for diffs
Mon Oct 23 20:11:31 2006 UTC (5 years, 3 months ago) by jhb
Branches: RELENG_4
Diff to: previous 1.16.2.5: preferred, colored; branchpoint 1.16: preferred, colored; next MAIN 1.17: preferred, colored
Changes since revision 1.16.2.5: +20 -20 lines
MFC: uthread fixes for select timeout and signal handling.

Revision 1.21.14.1: download - view: text, markup, annotated - select for diffs
Mon Oct 23 20:07:45 2006 UTC (5 years, 3 months ago) by jhb
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3, RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Branch point for: RELENG_6_4
Diff to: previous 1.21: preferred, colored; next MAIN 1.22: preferred, colored
Changes since revision 1.21: +20 -20 lines
MFC: Various uthread fixes:
- Delay setting wakeup time until after poll array has been allocated.
  Blocking on the malloc spinlock would cause the select timeout to be lost.
  (uthread_select.c 1.22)
- Delay unblocking signal and restoring process signal mask until the
  thread signal mask has been updated to avoid stack overflow during signal
  bursts.

  Don't block signal forever if no threads can currently handle signal.

  Check for pending signal after direct invocation of signal handler.
  (uthread_select.c 1.47)
- Backout unblocking of signal if no threads can currently handle it.
  The check for pending signal after direct invocation of signal handler
  is sufficient.
  (uthread_select.c 1.48)

Approved by:	re (mux, bmah)

Revision 1.22: download - view: text, markup, annotated - select for diffs
Fri Oct 13 20:04:13 2006 UTC (5 years, 4 months ago) by tegge
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +20 -20 lines
Delay setting wakeup time until after poll array has been allocated.
Blocking on the malloc spinlock would cause the select timeout to be lost.

Revision 1.16.2.5: download - view: text, markup, annotated - select for diffs
Tue Oct 22 14:44:03 2002 UTC (9 years, 3 months ago) by fjoe
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.16.2.4: preferred, colored; branchpoint 1.16: preferred, colored
Changes since revision 1.16.2.4: +18 -11 lines
MFC:

- signal handling
- thread suspension, add pthread_suspend/resume_all_np()

- don't allow the uthread kernel pipe to use the same descriptors as stdio
- make sigpending() and sigsuspend() account for signals that are pending on
the process as well as pending on the current thread
- thread_kern_poll(): limit maximum poll interval to 60 seconds
- _select(): return correct number of total bits set in all fd_set's,
change case of POLLNVAL as an error, remove POLLHUP and POLLERR from one case,
their place is most likely amongst read events
- use SA_RESTART for signal handlers
- disconnect uthread_sigblock.c and uthread_sigsetmask.c from the build,
remove sources not connected to build
- pthread_xxx and sem_xxx symbols are now weak
- remove #ifdef _THREAD_SAFE from sources -- it is not needed

Approved by:	deischen

Revision 1.16.2.4: download - view: text, markup, annotated - select for diffs
Thu Oct 17 19:37:38 2002 UTC (9 years, 3 months ago) by fjoe
Branches: RELENG_4
Diff to: previous 1.16.2.3: preferred, colored; branchpoint 1.16: preferred, colored
Changes since revision 1.16.2.3: +10 -9 lines
MFC: Diff reduction to -current libc_r (part 2/2):
- _get_curthread()/_set_curthread()
- use struct 'pthread *' instead of 'pthread_t' internally
- join_status.ret is now 'void *' instead of 'int'
- use FALLTHROUGH instead of "fall through"
- correct PANIC message in pthread_exit()

Approved by:	deischen

Revision 1.16.2.3: download - view: text, markup, annotated - select for diffs
Tue Oct 15 19:46:47 2002 UTC (9 years, 3 months ago) by fjoe
Branches: RELENG_4
Diff to: previous 1.16.2.2: preferred, colored; branchpoint 1.16: preferred, colored
Changes since revision 1.16.2.2: +1 -1 lines
MFC: Diff reduction to -current libc_r (part 1):
_thread_sys_{syscall} -> __sys_{syscall}.

This change does not break ABI because these symbols are used solely
inside libc_r.

Approved by:	deischen

Revision 1.16.2.2: download - view: text, markup, annotated - select for diffs
Sat Aug 31 21:57:39 2002 UTC (9 years, 5 months ago) by archie
Branches: RELENG_4
CVS tags: RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7
Diff to: previous 1.16.2.1: preferred, colored; branchpoint 1.16: preferred, colored
Changes since revision 1.16.2.1: +6 -4 lines
MFC: (rev. 1.21) Make select() set the readable/writable bits when poll()
returns POLLERR, POLLHUP, or POLLNVAL.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Thu Aug 29 21:39:19 2002 UTC (9 years, 5 months ago) by archie
Branches: MAIN
CVS tags: RELENG_6_BP, RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1, RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0, RELENG_5_BP, RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5, RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3, RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2, RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1, RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0, RELENG_5
Branch point for: RELENG_6
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +6 -4 lines
Make the libc_r version of select() set the readable or writable
file descriptor bit if poll() returns POLLERR, POLLHUP, or POLLNVAL.
Othewise, it's possible for select() to return successfully but
with no bits set.

Reviewed by:	deischen
MFC after:	3 days
PR:		bin/42175

Revision 1.16.2.1: download - view: text, markup, annotated - select for diffs
Tue May 7 17:32:48 2002 UTC (9 years, 9 months ago) by archie
Branches: RELENG_4
CVS tags: RELENG_4_6_BP, RELENG_4_6_2_RELEASE, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE, RELENG_4_6
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +13 -2 lines
MFC: Cancellate poll(2), readv(2), select(2), wait4(2), and writev(2).

Approved by:	re

Revision 1.20: download - view: text, markup, annotated - select for diffs
Thu May 2 19:58:43 2002 UTC (9 years, 9 months ago) by archie
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +14 -1 lines
Make these functions cancellation points like they should be:
poll(2), readv(2), select(2), wait4(2), writev(2).

PR:		bin/37658
Reviewed by:	deischen
MFC after:	1 week

Revision 1.19: download - view: text, markup, annotated - select for diffs
Tue Apr 9 05:41:00 2002 UTC (9 years, 10 months ago) by asmodai
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +19 -10 lines
Return correct number of total bits set in all fd_set's.
Change case of POLLNVAL as an error.
Remove POLLHUP and POLLERR from one case, their place is most likely
amongst read events.

PR:		33723
Submitted by:	Alexander Litvin <archer@whichever.org>
Reviewed by:	deischen [Provided a small change to the PR patch as well]
MFC after:	4 weeks

Revision 1.18: download - view: text, markup, annotated - select for diffs
Tue Apr 10 04:19:20 2001 UTC (10 years, 10 months ago) by deischen
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +2 -2 lines
To be consistent, use the __weak_reference macro from <sys/cdefs.h>
instead of #pragma weak to create weak definitions.

Suggested by:	bde

Revision 1.17: download - view: text, markup, annotated - select for diffs
Wed Jan 24 13:03:34 2001 UTC (11 years ago) by deischen
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +14 -15 lines
Add weak definitions for wrapped system calls.  In general:

	_foo - wrapped system call
	foo - weak definition to _foo

and for cancellation points:

	_foo - wrapped system call
	__foo - enter cancellation point, call _foo(), leave
	        cancellation point
	foo - weak definition to __foo

Change use of global _thread_run to call a function to get the
currently running thread.

Make all pthread_foo functions weak definitions to _pthread_foo,
where _pthread_foo is the implementation.  This allows an application
to provide its own pthread functions.

Provide slightly different versions of pthread_mutex_lock and
pthread_mutex_init so that we can tell the difference between
a libc mutex and an application mutex.  Threads holding mutexes
internal to libc should never be allowed to exit, call signal
handlers, or cancel.

Approved by:	-arch

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sat Jan 29 22:53:50 2000 UTC (12 years ago) by jasone
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_5_BP, RELENG_4_5_0_RELEASE, RELENG_4_5, RELENG_4_4_BP, RELENG_4_4_0_RELEASE, RELENG_4_4, RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_3, RELENG_4_2_0_RELEASE, RELENG_4_1_1_RELEASE, RELENG_4_1_0_RELEASE, RELENG_4_0_0_RELEASE, PRE_SMPNG
Branch point for: RELENG_4
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +2 -2 lines
Use __strong_reference() instead of __weak_reference() to assure that the
weak symbols of the same name are not used.

Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Jan 27 23:07:15 2000 UTC (12 years ago) by jasone
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +4 -4 lines
Simplify sytem call renaming.  Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen

Revision 1.14: download - view: text, markup, annotated - select for diffs
Wed Jan 12 09:28:51 2000 UTC (12 years, 1 month ago) by jasone
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +5 -3 lines
Track libc's three-tier symbol naming.  libc_r must currently implement
the _libc_*() entry points and add *() weak aliases.  This will all
change for the better when libc_r becomes libpthread.

Revision 1.5.2.6: download - view: text, markup, annotated - select for diffs
Mon Aug 30 00:20:02 1999 UTC (12 years, 5 months ago) by deischen
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE, RELENG_3_4_0_RELEASE, RELENG_3_3_0_RELEASE
Diff to: previous 1.5.2.5: preferred, colored; branchpoint 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5.2.5: +6 -4 lines
MFC:  Make checks for invalid timevals in select() and poll() return
      -1 and set errno to EINVAL.  Added check for null timespec in
      pthread_cond_timedwait().

Revision 1.13: download - view: text, markup, annotated - select for diffs
Mon Aug 30 00:02:08 1999 UTC (12 years, 5 months ago) by deischen
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +5 -3 lines
When checking for valid timevals in the wrapped select() and poll()
routines, don't return EINVAL but set errno to EINVAL and return -1.
Added a check in pthread_cond_timedwait for a null timespec pointer.

Revision 1.5.2.5: download - view: text, markup, annotated - select for diffs
Sun Aug 29 14:56:02 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
Diff to: previous 1.5.2.4: preferred, colored; branchpoint 1.5: preferred, colored
Changes since revision 1.5.2.4: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:03:45 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.5.2.4: download - view: text, markup, annotated - select for diffs
Fri Aug 20 21:17:45 1999 UTC (12 years, 5 months ago) by alfred
Branches: RELENG_3
Diff to: previous 1.5.2.3: preferred, colored; branchpoint 1.5: preferred, colored
Changes since revision 1.5.2.3: +5 -5 lines
MFC: 1.11

Reviewed by:	eivind

Revision 1.11: download - view: text, markup, annotated - select for diffs
Fri Aug 20 21:06:20 1999 UTC (12 years, 5 months ago) by alfred
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +5 -5 lines
move sanity check of timeval struct so as not to segfault when passed
a null pointer.

Pointed out by: Thomas Gellekum <tg@ihf.rwth-aachen.de>
Reviewed by:    eivind

Revision 1.5.2.3: download - view: text, markup, annotated - select for diffs
Thu Aug 19 23:29:37 1999 UTC (12 years, 5 months ago) by alfred
Branches: RELENG_3
Diff to: previous 1.5.2.2: preferred, colored; branchpoint 1.5: preferred, colored
Changes since revision 1.5.2.2: +5 -1 lines
MFC: sanity check time structures passed in
uthread_poll.c:       1.2
uthread_nanosleep.c:  1.9
uthread_select.c:     1.10
uthread_cond.c:       1.16

Revision 1.10: download - view: text, markup, annotated - select for diffs
Thu Aug 19 23:06:11 1999 UTC (12 years, 5 months ago) by alfred
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +5 -1 lines
Sanity check time structures passed in, return EINVAL like the system
calls do to avoid corrupting the thread library's concept of wakeup
time.

PR:		kern/12141
Reviewed by:	deischen, eivind

Revision 1.9: download - view: text, markup, annotated - select for diffs
Thu Aug 5 12:15:21 1999 UTC (12 years, 6 months ago) by deischen
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +2 -2 lines
Add RCS IDs to those files without them.
Fix copyrights (s/REGENTS/AUTHOR).

Suggested by:	tg
Approved by:	jb

Revision 1.5.2.2: download - view: text, markup, annotated - select for diffs
Fri Jul 23 13:00:32 1999 UTC (12 years, 6 months ago) by deischen
Branches: RELENG_3
Diff to: previous 1.5.2.1: preferred, colored; branchpoint 1.5: preferred, colored
Changes since revision 1.5.2.1: +107 -88 lines
MFC: Bring in both bug fixes, performance improvements, and enhancements
(addition of wrapped poll).

This should fix MySQL problems.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Wed Jun 23 15:01:22 1999 UTC (12 years, 7 months ago) by dt
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -1 lines
Fix few warnings on the alpha.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sun Jun 20 08:28:43 1999 UTC (12 years, 7 months ago) by jb
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +106 -88 lines
In the words of the author:

  o The polling mechanism for I/O readiness was changed from
    select() to poll().  In additon, a wrapped version of poll()
    is now provided.

  o The wrapped select routine now converts each fd_set to a
    poll array so that the thread scheduler doesn't have to
    perform a bitwise search for selected fds each time file
    descriptors are polled for I/O readiness.

  o The thread scheduler was modified to use a new queue (_workq)
    for threads that need work.  Threads waiting for I/O readiness
    and spinblocks are added to the work queue in addition to the
    waiting queue.  This reduces the time spent forming/searching
    the array of file descriptors being polled.

  o The waiting queue (_waitingq) is now maintained in order of
    thread wakeup time.  This allows the thread scheduler to
    find the nearest wakeup time by looking at the first thread
    in the queue instead of searching the entire queue.

  o Removed file descriptor locking for select/poll routines.  An
    application should not rely on the threads library for providing
    this locking; if necessary, the application should use mutexes
    to protect selecting/polling of file descriptors.

  o Retrieve and use the kernel clock rate/resolution at startup
    instead of hardcoding the clock resolution to 10 msec (tested
    with kernel running at 1000 HZ).

  o All queues have been changed to use queue.h macros.  These
    include the queues of all threads, dead threads, and threads
    waiting for file descriptor locks.

  o Added reinitialization of the GC mutex and condition variable
    after a fork.  Also prevented reallocation of the ready queue
    after a fork.

  o Prevented the wrapped close routine from closing the thread
    kernel pipes.

  o Initialized file descriptor table for stdio entries at thread
    init.

  o Provided additional flags to indicate to what queues threads
    belong.

  o Moved TAILQ initialization for statically allocated mutex and
    condition variables to after the spinlock.

  o Added dispatching of signals to pthread_kill.  Removing the
    dispatching of signals from thread activation broke sigsuspend
    when pthread_kill was used to send a signal to a thread.

  o Temporarily set the state of a thread to PS_SUSPENDED when it
    is first created and placed in the list of threads so that it
    will not be accidentally scheduled before becoming a member
    of one of the scheduling queues.

  o Change the signal handler to queue signals to the thread kernel
    pipe if the scheduling queues are protected.  When scheduling
    queues are unprotected, signals are then dequeued and handled.

  o Ensured that all installed signal handlers block the scheduling
    signal and that the scheduling signal handler blocks all
    other signals.  This ensures that the signal handler is only
    interruptible for and by non-scheduling signals.  An atomic
    lock is used to decide which instance of the signal handler
    will handle pending signals.

  o Removed _lock_thread_list and _unlock_thread_list as they are
    no longer used to protect the thread list.

  o Added missing RCS IDs to modified files.

  o Added checks for appropriate queue membership and activity when
    adding, removing, and searching the scheduling queues.  These
    checks add very little overhead and are enabled when compiled
    with _PTHREADS_INVARIANTS defined.  Suggested and implemented
    by Tor Egge with some modification by me.

  o Close a race condition in uthread_close.  (Tor Egge)

  o Protect the scheduling queues while modifying them in
    pthread_cond_signal and _thread_fd_unlock.  (Tor Egge)

  o Ensure that when a thread gets a mutex, the mutex is on that
    threads list of owned mutexes.  (Tor Egge)

  o Set the kernel-in-scheduler flag in _thread_kern_sched_state
    and _thread_kern_sched_state_unlock to prevent a scheduling
    signal from calling the scheduler again.  (Tor Egge)

  o Don't use TAILQ_FOREACH macro while searching the waiting
    queue for threads in a sigwait state, because a change of
    state destroys the TAILQ link.  It is actually safe to do
    so, though, because once a sigwaiting thread is found, the
    loop ends and the function returns.  (Tor Egge)

  o When dispatching signals to threads, make the thread inherit
    the signal deferral flag of the currently running thread.
    (Tor Egge)

Submitted by: Daniel Eischen <eischen@vigrid.com> and
              Tor Egge <Tor.Egge@fast.no>

Revision 1.5.2.1: download - view: text, markup, annotated - select for diffs
Sun May 9 07:48:46 1999 UTC (12 years, 9 months ago) by jb
Branches: RELENG_3
CVS tags: RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +5 -1 lines
MFC: (mostly) Realtime scheduling patches from Dan Eischen.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Tue Mar 23 05:07:56 1999 UTC (12 years, 10 months ago) by jb
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +5 -1 lines
  [ The author's description... ]

  o Runnable threads are now maintained in priority queues.  The
    implementation requires two things:

      1.) The priority queues must be protected during insertion
          and removal of threads.  Since the kernel scheduler
          must modify the priority queues, a spinlock for
          protection cannot be used.   The functions
          _thread_kern_sched_defer() and _thread_kern_sched_undefer()
          were added to {un}defer kernel scheduler activation.

      2.) A thread (active) priority change can be performed only
          when the thread is removed from the priority queue.  The
          implementation uses a threads active priority when
          inserting it into the queue.

    A by-product is that thread switches are much faster.  A
    separate queue is used for waiting and/or blocked threads,
    and it is searched at most 2 times in the kernel scheduler
    when there are active threads.  It should be possible to
    reduce this to once by combining polling of threads waiting
    on I/O with the loop that looks for timed out threads and
    the minimum timeout value.

  o Functions to defer kernel scheduler activation were added.  These
    are _thread_kern_sched_defer() and _thread_kern_sched_undefer()
    and may be called recursively.  These routines do not block the
    scheduling signal, but latch its occurrence.  The signal handler
    will not call the kernel scheduler when the running thread has
    deferred scheduling, but it will be called when running thread
    undefers scheduling.

  o Added support for _POSIX_THREAD_PRIORITY_SCHEDULING.  All the
    POSIX routines required by this should now be implemented.
    One note, SCHED_OTHER, SCHED_FIFO, and SCHED_RR are required
    to be defined by including pthread.h.  These defines are currently
    in sched.h.  I modified pthread.h to include sched.h but don't
    know if this is the proper thing to do.

  o Added support for priority protection and inheritence mutexes.
    This allows definition of _POSIX_THREAD_PRIO_PROTECT and
    _POSIX_THREAD_PRIO_INHERIT.

  o Added additional error checks required by POSIX for mutexes and
    condition variables.

  o Provided a wrapper for sigpending which is marked as a hidden
    syscall.

  o Added a non-portable function as a debugging aid to allow an
    application to monitor thread context switches.  An application
    can install a routine that gets called everytime a thread
    (explicitly created by the application) gets context switched.
    The routine gets passed the pthread IDs of the threads that are
    being switched in and out.

Submitted by: Dan Eischen <eischen@vigrid.com>

Changes by me:

  o Added a PS_SPINBLOCK state to deal with the priority inversion
    problem most often (I think) seen by threads calling malloc/free/realloc.

  o Dispatch signals to the running thread directly rather than at a
    context switch to avoid the situation where the switch never occurs.

Revision 1.2.2.2: download - view: text, markup, annotated - select for diffs
Wed Nov 4 08:42:11 1998 UTC (13 years, 3 months ago) by tg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_8_RELEASE
Diff to: previous 1.2.2.1: preferred, colored; branchpoint 1.2: preferred, colored; next MAIN 1.3: preferred, colored
Changes since revision 1.2.2.1: +13 -8 lines
As theatened two weeks ago: merge the major changes from -current's pthread
implementation. This includes file locking based on FILE *, signal fixes,
read/write-locks, better POSIX compliance and better performance. Not included
are changes relating to realtime scheduling.

Famous last words: I've now built the world several times with these changes,
so they shouldn't break anything.

Revision 1.2.2.1: download - view: text, markup, annotated - select for diffs
Fri Jun 12 22:56:49 1998 UTC (13 years, 8 months ago) by jb
Branches: RELENG_2_2
CVS tags: RELENG_2_2_7_RELEASE
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +1 -1 lines
MFC. Update file descriptor masks when no file descriptors are ready.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Fri Jun 12 02:17:18 1998 UTC (13 years, 8 months ago) by jb
Branches: MAIN
CVS tags: RELENG_3_BP, RELENG_3_1_0_RELEASE, RELENG_3_0_0_RELEASE
Branch point for: RELENG_3
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +1 -1 lines
Update the caller's descriptor masks even if there are none ready for
I/O for those applications that don't believe the return value of zero as
meaning that THERE ARE *NO* DESCRIPTORS READY.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Tue Jun 9 23:20:56 1998 UTC (13 years, 8 months ago) by jb
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +6 -6 lines
Implement compile time debug support instead of tracking file name and
line number every time a file descriptor is locked.

This looks like a big change but it isn't. It should reduce the size
of libc_r and make it run slightly faster.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Wed Apr 29 09:59:13 1998 UTC (13 years, 9 months ago) by jb
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +7 -2 lines
Change signal model to match POSIX (i.e. one set of signal handlers
for the process, not a separate set for each thread). By default, the
process now only has signal handlers installed for SIGVTALRM, SIGINFO
and SIGCHLD. The thread kernel signal handler is installed for other
signals on demand. This means that SIG_IGN and SIG_DFL processing is now
left to the kernel, not the thread kernel.

Change the signal dispatch to no longer use a signal thread, and
call the signal handler using the stack of the thread that has the
signal pending.

Change the atomic lock method to use test-and-set asm code with
a yield if blocked. This introduces separate locks for each type
of object instead of blocking signals to prevent a context
switch. It was this blocking of signals that caused the performance
degradation the people have noted.

This is a *big* change!

Revision 1.2: download - view: text, markup, annotated - select for diffs
Tue Aug 20 08:21:38 1996 UTC (15 years, 5 months ago) by julian
Branches: MAIN
CVS tags: RELENG_2_2_BP, RELENG_2_2_6_RELEASE, RELENG_2_2_5_RELEASE, RELENG_2_2_2_RELEASE, RELENG_2_2_1_RELEASE, RELENG_2_2_0_RELEASE
Branch point for: RELENG_2_2
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +9 -16 lines
Submitted by: John Birrell <cimaxp1!jb@werple.net.au>

Here are the diffs for libc_r to get it one step closer to P1003.1c
These make most of the thread/mutex/condvar structures opaque to the
user. There are three functions which have been renamed with _np
suffixes because they are extensions to P1003.1c (I did them for JAVA,
which needs to suspend/resume threads and also start threads suspended).

I've created a new header (pthread_np.h) for the non-POSIX stuff.

The egrep tags stuff in /usr/src/lib/libc_r/Makefile that I uncommented
doesn't work. I think its best to delete it. I don't think libc_r needs
tags anyway, 'cause most of the source is in libc which does have tags.

also:

Here's the first batch of man pages for the thread functions.
The diff to /usr/src/lib/libc_r/Makefile removes some stuff that was
inherited from /usr/src/lib/libc/Makefile that should only be done with
libc.

also:

I should have sent this diff with the pthread(3) man page.
It allows people to type

make -DWANT_LIBC_R world

to get libc_r built with the rest of the world. I put this in the
pthread(3) man page.  The default is still not to build libc_r.


also:
The diff attached adds a pthread(3) man page to /usr/src/share/man/man3.
The idea is that without libc_r installed, this man page will give people
enough info to know that they have to build libc_r.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Mon Jan 22 00:23:39 1996 UTC (16 years ago) by julian
Branches: MAIN
Reviewed by:	 julian
Submitted by:	 john birrel

One version of the pthreads library
another will follow with differnt actions under some cases..
not QUITE complete

Diff request

This form allows you to request diffs 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.

Log view options