aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2011-08-04 19:04:39 +0200
committerJan Djärv2011-08-04 19:04:39 +0200
commitae9e757af16bd39c21496430f66bcca2a47b4835 (patch)
treec442ffcf54a7946841d42365b4f426200a5f3cb1 /src
parent213bd7f2f126e8f69cbb9be274ea99581937f193 (diff)
downloademacs-ae9e757af16bd39c21496430f66bcca2a47b4835.tar.gz
emacs-ae9e757af16bd39c21496430f66bcca2a47b4835.zip
Check for pthread and use it if found.
* configure.in (HAVE_PTHREAD): Add check for -lpthread. (HAVE_GTK_AND_PTHREAD): Remove. * src/Makefile.in (LIB_PTHREAD): New variable. (LIBES): Add LIB_PTHREAD (Bug#9216). * src/alloc.c, src/emacs.c, src/gmalloc.c, src/gtkutil.c, src/keyboard.c, src/syssignal.h: Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/Makefile.in5
-rw-r--r--src/alloc.c18
-rw-r--r--src/emacs.c4
-rw-r--r--src/gmalloc.c2
-rw-r--r--src/gtkutil.c12
-rw-r--r--src/keyboard.c2
-rw-r--r--src/syssignal.h2
8 files changed, 33 insertions, 20 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b8a1c3e6e9a..8ed6761e1dd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12011-08-04 Jan Djärv <jan.h.d@swipnet.se>
2
3 * Makefile.in (LIB_PTHREAD): New variable.
4 (LIBES): Add LIB_PTHREAD (Bug#9216).
5
6 * alloc.c, emacs.c, gmalloc.c, gtkutil.c, keyboard.c, syssignal.h:
7 Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
8
12011-08-04 Andreas Schwab <schwab@linux-m68k.org> 92011-08-04 Andreas Schwab <schwab@linux-m68k.org>
2 10
3 * regex.c (re_iswctype): Remove some redundant boolean 11 * regex.c (re_iswctype): Remove some redundant boolean
diff --git a/src/Makefile.in b/src/Makefile.in
index f68fa5c2240..af4d6df9f8f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -130,6 +130,9 @@ START_FILES = @START_FILES@
130## -lm, or empty. 130## -lm, or empty.
131LIB_MATH=@LIB_MATH@ 131LIB_MATH=@LIB_MATH@
132 132
133## -lpthreads, or empty.
134LIB_PTHREAD=@LIB_PTHREAD@
135
133LIBTIFF=@LIBTIFF@ 136LIBTIFF=@LIBTIFF@
134LIBJPEG=@LIBJPEG@ 137LIBJPEG=@LIBJPEG@
135LIBPNG=@LIBPNG@ 138LIBPNG=@LIBPNG@
@@ -385,7 +388,7 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
385 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 388 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
386 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 389 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
387 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 390 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
388 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD_SIGMASK) \ 391 $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(LIB_PTHREAD_SIGMASK) \
389 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 392 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
390 393
391all: emacs$(EXEEXT) $(OTHER_FILES) 394all: emacs$(EXEEXT) $(OTHER_FILES)
diff --git a/src/alloc.c b/src/alloc.c
index b96fc1f0642..36ad645612d 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -24,7 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24 24
25#include <signal.h> 25#include <signal.h>
26 26
27#ifdef HAVE_GTK_AND_PTHREAD 27#ifdef HAVE_PTHREAD
28#include <pthread.h> 28#include <pthread.h>
29#endif 29#endif
30 30
@@ -84,13 +84,15 @@ extern size_t __malloc_extra_blocks;
84#endif /* not DOUG_LEA_MALLOC */ 84#endif /* not DOUG_LEA_MALLOC */
85 85
86#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT 86#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT
87#ifdef HAVE_GTK_AND_PTHREAD 87#ifdef HAVE_PTHREAD
88 88
89/* When GTK uses the file chooser dialog, different backends can be loaded 89/* When GTK uses the file chooser dialog, different backends can be loaded
90 dynamically. One such a backend is the Gnome VFS backend that gets loaded 90 dynamically. One such a backend is the Gnome VFS backend that gets loaded
91 if you run Gnome. That backend creates several threads and also allocates 91 if you run Gnome. That backend creates several threads and also allocates
92 memory with malloc. 92 memory with malloc.
93 93
94 Also, gconf and gsettings may create several threads.
95
94 If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_* 96 If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_*
95 functions below are called from malloc, there is a chance that one 97 functions below are called from malloc, there is a chance that one
96 of these threads preempts the Emacs main thread and the hook variables 98 of these threads preempts the Emacs main thread and the hook variables
@@ -122,12 +124,12 @@ static pthread_mutex_t alloc_mutex;
122 } \ 124 } \
123 while (0) 125 while (0)
124 126
125#else /* ! defined HAVE_GTK_AND_PTHREAD */ 127#else /* ! defined HAVE_PTHREAD */
126 128
127#define BLOCK_INPUT_ALLOC BLOCK_INPUT 129#define BLOCK_INPUT_ALLOC BLOCK_INPUT
128#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT 130#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
129 131
130#endif /* ! defined HAVE_GTK_AND_PTHREAD */ 132#endif /* ! defined HAVE_PTHREAD */
131#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ 133#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
132 134
133/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer 135/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
@@ -1265,7 +1267,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
1265} 1267}
1266 1268
1267 1269
1268#ifdef HAVE_GTK_AND_PTHREAD 1270#ifdef HAVE_PTHREAD
1269/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a 1271/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a
1270 normal malloc. Some thread implementations need this as they call 1272 normal malloc. Some thread implementations need this as they call
1271 malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then 1273 malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then
@@ -1278,7 +1280,7 @@ reset_malloc_hooks (void)
1278 __malloc_hook = old_malloc_hook; 1280 __malloc_hook = old_malloc_hook;
1279 __realloc_hook = old_realloc_hook; 1281 __realloc_hook = old_realloc_hook;
1280} 1282}
1281#endif /* HAVE_GTK_AND_PTHREAD */ 1283#endif /* HAVE_PTHREAD */
1282 1284
1283 1285
1284/* Called from main to set up malloc to use our hooks. */ 1286/* Called from main to set up malloc to use our hooks. */
@@ -1286,7 +1288,7 @@ reset_malloc_hooks (void)
1286void 1288void
1287uninterrupt_malloc (void) 1289uninterrupt_malloc (void)
1288{ 1290{
1289#ifdef HAVE_GTK_AND_PTHREAD 1291#ifdef HAVE_PTHREAD
1290#ifdef DOUG_LEA_MALLOC 1292#ifdef DOUG_LEA_MALLOC
1291 pthread_mutexattr_t attr; 1293 pthread_mutexattr_t attr;
1292 1294
@@ -1300,7 +1302,7 @@ uninterrupt_malloc (void)
1300 and the bundled gmalloc.c doesn't require it. */ 1302 and the bundled gmalloc.c doesn't require it. */
1301 pthread_mutex_init (&alloc_mutex, NULL); 1303 pthread_mutex_init (&alloc_mutex, NULL);
1302#endif /* !DOUG_LEA_MALLOC */ 1304#endif /* !DOUG_LEA_MALLOC */
1303#endif /* HAVE_GTK_AND_PTHREAD */ 1305#endif /* HAVE_PTHREAD */
1304 1306
1305 if (__free_hook != emacs_blocked_free) 1307 if (__free_hook != emacs_blocked_free)
1306 old_free_hook = __free_hook; 1308 old_free_hook = __free_hook;
diff --git a/src/emacs.c b/src/emacs.c
index 39870ec0079..778cf00a527 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1120,7 +1120,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1120#if defined (USG5) && defined (INTERRUPT_INPUT) 1120#if defined (USG5) && defined (INTERRUPT_INPUT)
1121 setpgrp (); 1121 setpgrp ();
1122#endif 1122#endif
1123#if defined (HAVE_GTK_AND_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC) 1123#if defined (HAVE_PTHREAD) && !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
1124 { 1124 {
1125 extern void malloc_enable_thread (void); 1125 extern void malloc_enable_thread (void);
1126 1126
@@ -2185,7 +2185,7 @@ You must run Emacs in batch mode in order to dump it. */)
2185 memory_warnings (my_edata, malloc_warning); 2185 memory_warnings (my_edata, malloc_warning);
2186 } 2186 }
2187#endif /* not WINDOWSNT */ 2187#endif /* not WINDOWSNT */
2188#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT 2188#if defined (HAVE_PTHREAD) && !defined SYNC_INPUT
2189 /* Pthread may call malloc before main, and then we will get an endless 2189 /* Pthread may call malloc before main, and then we will get an endless
2190 loop, because pthread_self (see alloc.c) calls malloc the first time 2190 loop, because pthread_self (see alloc.c) calls malloc the first time
2191 it is called on some systems. */ 2191 it is called on some systems. */
diff --git a/src/gmalloc.c b/src/gmalloc.c
index fa4aa1fdf6a..916bb300fe1 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -37,7 +37,7 @@ Fifth Floor, Boston, MA 02110-1301, USA.
37#include <config.h> 37#include <config.h>
38#endif 38#endif
39 39
40#ifdef HAVE_GTK_AND_PTHREAD 40#ifdef HAVE_PTHREAD
41#define USE_PTHREAD 41#define USE_PTHREAD
42#endif 42#endif
43 43
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 8826b08851a..dd4d99b9d33 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1907,12 +1907,12 @@ xg_get_file_name (FRAME_PTR f,
1907 int filesel_done = 0; 1907 int filesel_done = 0;
1908 xg_get_file_func func; 1908 xg_get_file_func func;
1909 1909
1910#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) 1910#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
1911 /* I really don't know why this is needed, but without this the GLIBC add on 1911 /* I really don't know why this is needed, but without this the GLIBC add on
1912 library linuxthreads hangs when the Gnome file chooser backend creates 1912 library linuxthreads hangs when the Gnome file chooser backend creates
1913 threads. */ 1913 threads. */
1914 sigblock (sigmask (__SIGRTMIN)); 1914 sigblock (sigmask (__SIGRTMIN));
1915#endif /* HAVE_GTK_AND_PTHREAD */ 1915#endif /* HAVE_PTHREAD */
1916 1916
1917#ifdef HAVE_GTK_FILE_SELECTION_NEW 1917#ifdef HAVE_GTK_FILE_SELECTION_NEW
1918 1918
@@ -1932,7 +1932,7 @@ xg_get_file_name (FRAME_PTR f,
1932 1932
1933 filesel_done = xg_dialog_run (f, w); 1933 filesel_done = xg_dialog_run (f, w);
1934 1934
1935#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) 1935#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
1936 sigunblock (sigmask (__SIGRTMIN)); 1936 sigunblock (sigmask (__SIGRTMIN));
1937#endif 1937#endif
1938 1938
@@ -1960,9 +1960,9 @@ xg_get_font_name (FRAME_PTR f, const char *default_name)
1960 char *fontname = NULL; 1960 char *fontname = NULL;
1961 int done = 0; 1961 int done = 0;
1962 1962
1963#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) 1963#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
1964 sigblock (sigmask (__SIGRTMIN)); 1964 sigblock (sigmask (__SIGRTMIN));
1965#endif /* HAVE_GTK_AND_PTHREAD */ 1965#endif /* HAVE_PTHREAD */
1966 1966
1967 w = gtk_font_selection_dialog_new ("Pick a font"); 1967 w = gtk_font_selection_dialog_new ("Pick a font");
1968 if (!default_name) 1968 if (!default_name)
@@ -1974,7 +1974,7 @@ xg_get_font_name (FRAME_PTR f, const char *default_name)
1974 1974
1975 done = xg_dialog_run (f, w); 1975 done = xg_dialog_run (f, w);
1976 1976
1977#if defined (HAVE_GTK_AND_PTHREAD) && defined (__SIGRTMIN) 1977#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
1978 sigunblock (sigmask (__SIGRTMIN)); 1978 sigunblock (sigmask (__SIGRTMIN));
1979#endif 1979#endif
1980 1980
diff --git a/src/keyboard.c b/src/keyboard.c
index 7e144b80a09..1c7c22e9f15 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#include "process.h" 44#include "process.h"
45#include <errno.h> 45#include <errno.h>
46 46
47#ifdef HAVE_GTK_AND_PTHREAD 47#ifdef HAVE_PTHREAD
48#include <pthread.h> 48#include <pthread.h>
49#endif 49#endif
50#ifdef MSDOS 50#ifdef MSDOS
diff --git a/src/syssignal.h b/src/syssignal.h
index c5c749407cc..7533a5a64fd 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -18,7 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19extern void init_signals (void); 19extern void init_signals (void);
20 20
21#if defined (HAVE_GTK_AND_PTHREAD) || defined (HAVE_NS) 21#ifdef HAVE_PTHREAD
22#include <pthread.h> 22#include <pthread.h>
23/* If defined, asynchronous signals delivered to a non-main thread are 23/* If defined, asynchronous signals delivered to a non-main thread are
24 forwarded to the main thread. */ 24 forwarded to the main thread. */