freebsd-skq/lib/libpthread/thread
John Birrell 58a7cc5d1b [ 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.
1999-03-23 05:07:56 +00:00
..
Makefile.inc [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_destroy.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_getdetachstate.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_getinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_getstackaddr.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_getstacksize.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_init.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_setcreatesuspend_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
thr_attr_setdetachstate.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_setinheritsched.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setschedpolicy.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setscope.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_attr_setstackaddr.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_attr_setstacksize.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_clean.c Submitted by: John Birrell 1997-02-05 23:26:09 +00:00
thr_close.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
thr_cond.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_condattr_destroy.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
thr_condattr_init.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
thr_create.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_detach.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_equal.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
thr_exit.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_fcntl.c Removed unused variables. 1998-09-07 21:55:01 +00:00
thr_find_thread.c Move the cleanup code that frees memory allocated for a dead thread from 1998-09-30 06:36:56 +00:00
thr_fork.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_fsync.c Implement compile time debug support instead of tracking file name and 1998-06-09 23:21:05 +00:00
thr_gc.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_getprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_getschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_info.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_join.c Add the missing {} that caused the function to return ESRCH if it 1998-06-25 00:04:21 +00:00
thr_kern.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_kill.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mattr_init.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mattr_kind_np.c Add support for pthread_mutexattr_settype(). As a side effect of 1998-11-28 23:52:58 +00:00
thr_multi_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
thr_mutex_prioceiling.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutex_protocol.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutex.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_mutexattr_destroy.c Modify the return values to comply with POSIX. Previously these 1997-11-25 01:29:16 +00:00
thr_nanosleep.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_once.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
thr_open.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_priority_queue.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_private.h [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_read.c Check the access mode in the flags before waiting on a read or a write 1998-06-10 22:28:45 +00:00
thr_readv.c Check the access mode in the flags before waiting on a read or a write 1998-06-10 22:28:45 +00:00
thr_resume_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_rwlock.c Removed some variable initializations which were unnecessary and divergent 1998-09-07 21:07:59 +00:00
thr_rwlockattr.c -Wall clean. 1998-09-07 19:23:55 +00:00
thr_select.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_self.c Reviewed by: julian 1996-01-22 00:23:58 +00:00
thr_seterrno.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_setprio.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_setschedparam.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sig.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigaction.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigmask.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_sigpending.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_sigprocmask.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_sigsuspend.c Implementation of an additional state called SIGWAIT (with the previous 1998-09-30 06:27:31 +00:00
thr_sigwait.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_single_np.c Submitted by: John Birrell <cimaxp1!jb@werple.net.au> 1996-08-20 08:22:01 +00:00
thr_spec.c NULL a pointer after it is freed to avoid trying to free it again. 1998-09-30 06:24:57 +00:00
thr_spinlock.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_suspend_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_switch_np.c [ The author's description... ] 1999-03-23 05:07:56 +00:00
thr_vfork.c In libc_r, rename vfork syscall to _thread_sys_vfork and make vfork an alias 1998-09-12 22:03:20 +00:00
thr_wait4.c Change signal model to match POSIX (i.e. one set of signal handlers 1998-04-29 09:59:34 +00:00
thr_write.c Removed unused variables. 1998-09-07 21:55:01 +00:00
thr_writev.c If a short write, only loop if no error. 1998-06-14 09:36:14 +00:00
thr_yield.c Add sched_yield() witch is the draft 10 equivalent of pthread_yield() 1998-03-08 02:37:27 +00:00