emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why "in_sighandler"?


From: Jan Djärv
Subject: Re: why "in_sighandler"?
Date: Mon, 21 Aug 2006 08:18:38 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060808)



YAMAMOTO Mitsuharu skrev:
On Sun, 20 Aug 2006 18:37:30 +0200, "Jan D." <address@hidden> said:

I needed a variable that was only set when the signal handler is
running.

I've got no response from you to my last message (*1) in the related
thread.  So I'm not sure if you are for or against my suggestion about
undoing `in_sighandler'-related changes and just changing the order of
lock/unlock and BLOCK_INPUT/UNBLOCK_INPUT in the previous version of
BLOCK_INPUT_ALLOC/UNBLOCK_INPUT_ALLOC as follows.

#define BLOCK_INPUT_ALLOC                       \
  do                                            \
    {                                           \
      if (pthread_self () == main_thread)       \
        BLOCK_INPUT;                            \
      pthread_mutex_lock (&alloc_mutex);        \
    }                                           \
  while (0)
#define UNBLOCK_INPUT_ALLOC                     \
  do                                            \
    {                                           \
      pthread_mutex_unlock (&alloc_mutex);      \
      if (pthread_self () == main_thread)       \
        UNBLOCK_INPUT;                          \
    }                                           \
  while (0)



I don't like it, because it assumes things are "probably OK" to run in the signal handler (i.e. pthread_mutex_lock/unlock). I still think it might hang if a Gnome thread is in mutex_lock and a signal arrives and then the signal handler also enters mutex_lock. It is one assumtion against another, neither suggestion is without flaws (we need SYNC_INPUT for that).

        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]