Call XInitThreads() in posix frontend
XInitThreads() is needed in multi-threading X applications when multiple threads try to access the Xlib. Add the call to the three frontends in posix/ and add the required autoconf-stuff, too.
This commit is contained in:
parent
23f4dcc009
commit
0e86cf128d
|
@ -5,4 +5,4 @@ AM_CPPFLAGS += $(SDL_CFLAGS) $(ALSA_CFLAGS) $(LIBAGG_CFLAGS) $(GLIB_CFLAGS) $(GT
|
||||||
|
|
||||||
bin_PROGRAMS = desmume-cli
|
bin_PROGRAMS = desmume-cli
|
||||||
desmume_cli_SOURCES = main.cpp ../shared/sndsdl.cpp ../shared/ctrlssdl.h ../shared/ctrlssdl.cpp
|
desmume_cli_SOURCES = main.cpp ../shared/sndsdl.cpp ../shared/ctrlssdl.h ../shared/ctrlssdl.cpp
|
||||||
desmume_cli_LDADD = ../libdesmume.a $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(GLIB_LIBS) $(GTHREAD_LIBS) $(LIBSOUNDTOUCH_LIBS)
|
desmume_cli_LDADD = ../libdesmume.a $(X_LIBS) -lX11 $(SDL_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(GLIB_LIBS) $(GTHREAD_LIBS) $(LIBSOUNDTOUCH_LIBS)
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
#include <X11/Xlib.h>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_thread.h>
|
#include <SDL_thread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -641,6 +642,12 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
execute = true;
|
execute = true;
|
||||||
|
|
||||||
|
/* X11 multi-threading support */
|
||||||
|
if(!XInitThreads())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Warning: X11 not thread-safe\n");
|
||||||
|
}
|
||||||
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) == -1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error trying to initialize SDL: %s\n",
|
fprintf(stderr, "Error trying to initialize SDL: %s\n",
|
||||||
|
|
|
@ -53,6 +53,9 @@ AC_CHECK_LIB(zzip, zzip_open, [
|
||||||
AC_MSG_RESULT(no))
|
AC_MSG_RESULT(no))
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl - Check for X11
|
||||||
|
AC_PATH_X
|
||||||
|
|
||||||
dnl - Check for SDL
|
dnl - Check for SDL
|
||||||
AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])
|
AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])
|
||||||
if test ! "x$SDLCONFIG" = "x" ; then
|
if test ! "x$SDLCONFIG" = "x" ; then
|
||||||
|
|
|
@ -31,6 +31,7 @@ desmume_glade_SOURCES = \
|
||||||
../../../driver.h ../../../driver.cpp
|
../../../driver.h ../../../driver.cpp
|
||||||
|
|
||||||
desmume_glade_LDADD = ../libdesmume.a \
|
desmume_glade_LDADD = ../libdesmume.a \
|
||||||
|
$(X_LIBS) -lX11 \
|
||||||
$(SDL_LIBS) $(GTKGLEXT_LIBS) $(LIBGLADE_LIBS) \
|
$(SDL_LIBS) $(GTKGLEXT_LIBS) $(LIBGLADE_LIBS) \
|
||||||
$(GTHREAD_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) \
|
$(GTHREAD_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) \
|
||||||
$(LIBSOUNDTOUCH_LIBS)
|
$(LIBSOUNDTOUCH_LIBS)
|
||||||
|
|
|
@ -533,6 +533,12 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
init_configured_features( &my_config);
|
init_configured_features( &my_config);
|
||||||
|
|
||||||
|
/* X11 multi-threading support */
|
||||||
|
if(!XInitThreads())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Warning: X11 not thread-safe\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_thread_supported())
|
if (!g_thread_supported())
|
||||||
g_thread_init( NULL);
|
g_thread_init( NULL);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ desmume_SOURCES = \
|
||||||
cheatsGTK.h cheatsGTK.cpp \
|
cheatsGTK.h cheatsGTK.cpp \
|
||||||
main.cpp main.h
|
main.cpp main.h
|
||||||
desmume_LDADD = ../libdesmume.a \
|
desmume_LDADD = ../libdesmume.a \
|
||||||
$(SDL_LIBS) $(GTK_LIBS) $(GTHREAD_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(LIBSOUNDTOUCH_LIBS)
|
$(X_LIBS) -lX11 $(SDL_LIBS) $(GTK_LIBS) $(GTHREAD_LIBS) $(ALSA_LIBS) $(LIBAGG_LIBS) $(LIBSOUNDTOUCH_LIBS)
|
||||||
if HAVE_LIBOSMESA
|
if HAVE_LIBOSMESA
|
||||||
desmume_LDADD += $(OSMESA_LIBS)
|
desmume_LDADD += $(OSMESA_LIBS)
|
||||||
else
|
else
|
||||||
|
|
|
@ -3505,6 +3505,12 @@ int main (int argc, char *argv[])
|
||||||
my_config.parse(argc, argv);
|
my_config.parse(argc, argv);
|
||||||
init_configured_features( &my_config);
|
init_configured_features( &my_config);
|
||||||
|
|
||||||
|
/* X11 multi-threading support */
|
||||||
|
if(!XInitThreads())
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Warning: X11 not thread-safe\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_thread_supported())
|
if (!g_thread_supported())
|
||||||
g_thread_init( NULL);
|
g_thread_init( NULL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue