Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Sep 2010 02:18:33 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/lib/libthr/thread thr_cancel.c thr_cond.c thr_create.c thr_exit.c thr_fork.c thr_init.c thr_join.c thr_kern.c thr_private.h thr_rtld.c thr_sig.c thr_syscalls.c thr_umtx.c thr_umtx.h
Message-ID:  <201009010218.o812Im8K083066@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
davidxu     2010-09-01 02:18:33 UTC

  FreeBSD src repository

  Modified files:
    lib/libthr/thread    thr_cancel.c thr_cond.c thr_create.c 
                         thr_exit.c thr_fork.c thr_init.c 
                         thr_join.c thr_kern.c thr_private.h 
                         thr_rtld.c thr_sig.c thr_syscalls.c 
                         thr_umtx.c thr_umtx.h 
  Log:
  SVN rev 212076 on 2010-09-01 02:18:33Z by davidxu
  
  Add signal handler wrapper, the reason to add it becauses there are
  some cases we want to improve:
    1) if a thread signal got a signal while in cancellation point,
       it is possible the TDP_WAKEUP may be eaten by signal handler
       if the handler called some interruptibly system calls.
    2) In signal handler, we want to disable cancellation.
    3) When thread holding some low level locks, it is better to
       disable signal, those code need not to worry reentrancy,
       sigprocmask system call is avoided because it is a bit expensive.
  The signal handler wrapper works in this way:
    1) libthr installs its signal handler if user code invokes sigaction
       to install its handler, the user handler is recorded in internal
       array.
    2) when a signal is delivered, libthr's signal handler is invoke,
       libthr checks if thread holds some low level lock or is in critical
       region, if it is true, the signal is buffered, and all signals are
       masked, once the thread leaves critical region, correct signal
       mask is restored and buffered signal is processed.
    3) before user signal handler is invoked, cancellation is temporarily
       disabled, after user signal handler is returned, cancellation state
       is restored, and pending cancellation is rescheduled.
  
  Revision  Changes    Path
  1.18      +11 -30    src/lib/libthr/thread/thr_cancel.c
  1.27      +2 -2      src/lib/libthr/thread/thr_cond.c
  1.47      +0 -13     src/lib/libthr/thread/thr_create.c
  1.34      +19 -0     src/lib/libthr/thread/thr_exit.c
  1.17      +6 -0      src/lib/libthr/thread/thr_fork.c
  1.53      +1 -7      src/lib/libthr/thread/thr_init.c
  1.25      +2 -2      src/lib/libthr/thread/thr_join.c
  1.22      +0 -32     src/lib/libthr/thread/thr_kern.c
  1.104     +23 -10    src/lib/libthr/thread/thr_private.h
  1.15      +7 -6      src/lib/libthr/thread/thr_rtld.c
  1.34      +419 -99   src/lib/libthr/thread/thr_sig.c
  1.25      +57 -72    src/lib/libthr/thread/thr_syscalls.c
  1.19      +39 -0     src/lib/libthr/thread/thr_umtx.c
  1.16      +5 -0      src/lib/libthr/thread/thr_umtx.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009010218.o812Im8K083066>