Changeset 11500


Ignore:
Timestamp:
Dec 11, 2008, 9:17:04 AM (11 years ago)
Author:
gb
Message:

Since SIQQUIT can be sent to the process, using a handler for it to
force threads to die somewhat cleanly leads to unexpected behavior
(e.g., kills whatever thread's unlucky enough to receive that
signal.)

Reorganize things a bit, to minimize references to SIGQUIT and
hopefully make it easier to use some signal that's not used by
the platform unless we can reliably differentiate between
signals sent thread-to-thread and those sent sent "to the process."
(So far, it seems that Linux and Solaris reliably identify signals
sent by pthread_kill and FreeBSD and Darwin don't; unfortunately,
it may be harder to find "unused but usable" signal numbers on
FreeBSD and Darwin.)

These changes shouldn't change the status quo, but may make it
easier to do so.

Location:
trunk/source/lisp-kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/Threads.h

    r11184 r11500  
    240240#endif
    241241
    242 extern int thread_suspend_signal, thread_resume_signal;
     242
     243#define SIG_KILL_THREAD  SIGQUIT   /* unless we can find something better */
     244
     245extern int thread_suspend_signal, thread_quit_signal;
    243246
    244247void *
  • trunk/source/lisp-kernel/ppc-exceptions.c

    r11147 r11500  
    22062206{
    22072207  thread_suspend_signal = SIG_SUSPEND_THREAD;
     2208  thread_quit_signal = SIG_KILL_THREAD;
    22082209
    22092210  install_signal_handler(thread_suspend_signal, (void *) suspend_resume_handler);
  • trunk/source/lisp-kernel/thread_manager.c

    r11375 r11500  
    547547
    548548
    549 int thread_suspend_signal = 0, thread_resume_signal = 0;
     549int thread_suspend_signal = 0, thread_quit_signal = 0;
    550550
    551551
     
    20212021      }
    20222022#else
    2023       if (pthread_kill((pthread_t)osid,SIGQUIT)) {
     2023      if (pthread_kill((pthread_t)osid,thread_quit_signal)) {
    20242024        result = false;
    20252025      }
  • trunk/source/lisp-kernel/x86-exceptions.c

    r11372 r11500  
    20232023  TCR *tcr = get_tcr(false);
    20242024  sigset_t mask;
    2025  
     2025
    20262026  sigemptyset(&mask);
    20272027
    20282028  empty_tcr_stacks(tcr);
    2029  
     2029
    20302030  pthread_sigmask(SIG_SETMASK,&mask,NULL);
    20312031  pthread_exit(NULL);
     
    21102110{
    21112111  thread_suspend_signal = SIG_SUSPEND_THREAD;
     2112  thread_quit_signal = SIG_KILL_THREAD;
    21122113
    21132114  install_signal_handler(thread_suspend_signal, (void *)SUSPEND_RESUME_HANDLER);
    2114   install_signal_handler(SIGQUIT, (void *)QUIT_HANDLER);
     2115  install_signal_handler(thread_quit_signal, (void *)QUIT_HANDLER);
    21152116}
    21162117#endif
Note: See TracChangeset for help on using the changeset viewer.