mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-23 23:17:46 +01:00
More missing stuff...
git-svn-id: svn://localhost/ardour2/trunk@2645 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
a313924b77
commit
aa6faa86b5
32 changed files with 5856 additions and 0 deletions
19
libs/glibmm2/examples/thread/Makefile.am
Normal file
19
libs/glibmm2/examples/thread/Makefile.am
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
include $(top_srcdir)/examples/Makefile.am_fragment
|
||||
|
||||
INCLUDES += $(GTHREAD_CFLAGS)
|
||||
|
||||
## Build the executable, but don't install it.
|
||||
noinst_PROGRAMS = dispatcher dispatcher2 thread threadpool
|
||||
|
||||
dispatcher_SOURCES = dispatcher.cc
|
||||
dispatcher_LDFLAGS = $(GTHREAD_LIBS)
|
||||
|
||||
dispatcher2_SOURCES = dispatcher2.cc
|
||||
dispatcher2_LDFLAGS = $(GTHREAD_LIBS)
|
||||
|
||||
thread_SOURCES = thread.cc
|
||||
thread_LDFLAGS = $(GTHREAD_LIBS)
|
||||
|
||||
threadpool_SOURCES = threadpool.cc
|
||||
threadpool_LDFLAGS = $(GTHREAD_LIBS)
|
||||
|
||||
523
libs/glibmm2/examples/thread/Makefile.in
Normal file
523
libs/glibmm2/examples/thread/Makefile.in
Normal file
|
|
@ -0,0 +1,523 @@
|
|||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/examples/Makefile.am_fragment
|
||||
noinst_PROGRAMS = dispatcher$(EXEEXT) dispatcher2$(EXEEXT) \
|
||||
thread$(EXEEXT) threadpool$(EXEEXT)
|
||||
subdir = examples/thread
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/scripts/cxx.m4 \
|
||||
$(top_srcdir)/scripts/cxx_std.m4 \
|
||||
$(top_srcdir)/scripts/docgen.m4 \
|
||||
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
|
||||
$(top_srcdir)/scripts/macros.m4 \
|
||||
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h \
|
||||
$(top_builddir)/glib/glibmmconfig.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
am_dispatcher_OBJECTS = dispatcher.$(OBJEXT)
|
||||
dispatcher_OBJECTS = $(am_dispatcher_OBJECTS)
|
||||
dispatcher_LDADD = $(LDADD)
|
||||
am_dispatcher2_OBJECTS = dispatcher2.$(OBJEXT)
|
||||
dispatcher2_OBJECTS = $(am_dispatcher2_OBJECTS)
|
||||
dispatcher2_LDADD = $(LDADD)
|
||||
am_thread_OBJECTS = thread.$(OBJEXT)
|
||||
thread_OBJECTS = $(am_thread_OBJECTS)
|
||||
thread_LDADD = $(LDADD)
|
||||
am_threadpool_OBJECTS = threadpool.$(OBJEXT)
|
||||
threadpool_OBJECTS = $(am_threadpool_OBJECTS)
|
||||
threadpool_LDADD = $(LDADD)
|
||||
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
|
||||
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(dispatcher_SOURCES) $(dispatcher2_SOURCES) \
|
||||
$(thread_SOURCES) $(threadpool_SOURCES)
|
||||
DIST_SOURCES = $(dispatcher_SOURCES) $(dispatcher2_SOURCES) \
|
||||
$(thread_SOURCES) $(threadpool_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
|
||||
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
|
||||
GLIBMM_LIBS = @GLIBMM_LIBS@
|
||||
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
|
||||
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
|
||||
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
|
||||
GLIBMM_RELEASE = @GLIBMM_RELEASE@
|
||||
GLIBMM_VERSION = @GLIBMM_VERSION@
|
||||
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
|
||||
GTHREAD_LIBS = @GTHREAD_LIBS@
|
||||
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
|
||||
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
|
||||
GTKMM_FALSE_FALSE = @GTKMM_FALSE_FALSE@
|
||||
GTKMM_FALSE_TRUE = @GTKMM_FALSE_TRUE@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = $(local_glibmm_lib) $(GLIBMM_LIBS)
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
M4 = @M4@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OS_WIN32_FALSE = @OS_WIN32_FALSE@
|
||||
OS_WIN32_TRUE = @OS_WIN32_TRUE@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL_PATH = @PERL_PATH@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PLATFORM_WIN32_FALSE = @PLATFORM_WIN32_FALSE@
|
||||
PLATFORM_WIN32_TRUE = @PLATFORM_WIN32_TRUE@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_AS = @ac_ct_AS@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
local_glibmm_lib = $(top_builddir)/glib/glibmm/libglibmm-2.4.la
|
||||
all_includes = -I$(top_builddir)/glib -I$(top_srcdir)/glib \
|
||||
$(GLIBMM_CFLAGS) $(DISABLE_DEPRECATED_CFLAGS) $(DISABLE_DEPRECATED_API_CFLAGS)
|
||||
|
||||
DEFAULT_INCLUDES =
|
||||
INCLUDES = -I. -I$(srcdir) $(strip $(all_includes)) $(GTHREAD_CFLAGS)
|
||||
glibmm_docdir = $(datadir)/doc/glibmm-2.4
|
||||
dispatcher_SOURCES = dispatcher.cc
|
||||
dispatcher_LDFLAGS = $(GTHREAD_LIBS)
|
||||
dispatcher2_SOURCES = dispatcher2.cc
|
||||
dispatcher2_LDFLAGS = $(GTHREAD_LIBS)
|
||||
thread_SOURCES = thread.cc
|
||||
thread_LDFLAGS = $(GTHREAD_LIBS)
|
||||
threadpool_SOURCES = threadpool.cc
|
||||
threadpool_LDFLAGS = $(GTHREAD_LIBS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cc .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/examples/Makefile.am_fragment $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/thread/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/thread/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f $$p $$f"; \
|
||||
rm -f $$p $$f ; \
|
||||
done
|
||||
dispatcher$(EXEEXT): $(dispatcher_OBJECTS) $(dispatcher_DEPENDENCIES)
|
||||
@rm -f dispatcher$(EXEEXT)
|
||||
$(CXXLINK) $(dispatcher_LDFLAGS) $(dispatcher_OBJECTS) $(dispatcher_LDADD) $(LIBS)
|
||||
dispatcher2$(EXEEXT): $(dispatcher2_OBJECTS) $(dispatcher2_DEPENDENCIES)
|
||||
@rm -f dispatcher2$(EXEEXT)
|
||||
$(CXXLINK) $(dispatcher2_LDFLAGS) $(dispatcher2_OBJECTS) $(dispatcher2_LDADD) $(LIBS)
|
||||
thread$(EXEEXT): $(thread_OBJECTS) $(thread_DEPENDENCIES)
|
||||
@rm -f thread$(EXEEXT)
|
||||
$(CXXLINK) $(thread_LDFLAGS) $(thread_OBJECTS) $(thread_LDADD) $(LIBS)
|
||||
threadpool$(EXEEXT): $(threadpool_OBJECTS) $(threadpool_DEPENDENCIES)
|
||||
@rm -f threadpool$(EXEEXT)
|
||||
$(CXXLINK) $(threadpool_LDFLAGS) $(threadpool_OBJECTS) $(threadpool_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dispatcher.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dispatcher2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadpool.Po@am__quote@
|
||||
|
||||
.cc.o:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cc.obj:
|
||||
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.cc.lo:
|
||||
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(mkdir_p) $(distdir)/../../examples
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-data-local
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am uninstall-local
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstPROGRAMS ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-data-local install-exec install-exec-am install-info \
|
||||
install-info-am install-man install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-info-am uninstall-local
|
||||
|
||||
|
||||
install-example-src:
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(glibmm_docdir)/$(subdir)
|
||||
for p in $(srcdir)/*.cc $(srcdir)/*.h; do \
|
||||
if test -f $$p; then \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(glibmm_docdir)/$(subdir)/$$f"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(glibmm_docdir)/$(subdir)/$$f; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
uninstall-example-src:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
for p in $(srcdir)/*.cc $(srcdir)/*.h; do \
|
||||
if test -f $$p; then \
|
||||
f="`echo $$p | sed -e 's|^.*/||'`"; \
|
||||
echo " rm -f $(DESTDIR)$(glibmm_docdir)/$(subdir)/$$f"; \
|
||||
rm -f $(DESTDIR)$(glibmm_docdir)/$(subdir)/$$f; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install-data-local: install-example-src
|
||||
|
||||
uninstall-local: uninstall-example-src
|
||||
|
||||
.PHONY: install-example-src uninstall-example-src
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
197
libs/glibmm2/examples/thread/dispatcher.cc
Normal file
197
libs/glibmm2/examples/thread/dispatcher.cc
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* Glib::Dispatcher example -- cross thread signalling
|
||||
* by Daniel Elstner <daniel.elstner@gmx.net>
|
||||
*
|
||||
* modified to only use glibmm
|
||||
* by J. Abelardo Gutierrez <jabelardo@cantv.net>
|
||||
*
|
||||
* Copyright (c) 2002-2003 Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class ThreadProgress : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
explicit ThreadProgress(int id);
|
||||
virtual ~ThreadProgress();
|
||||
|
||||
void launch();
|
||||
void join();
|
||||
|
||||
sigc::signal<void>& signal_finished();
|
||||
int id() const;
|
||||
|
||||
virtual void reference() const { ++ref_count_; }
|
||||
virtual void unreference() const { if (!(--ref_count_)) delete this; }
|
||||
|
||||
private:
|
||||
Glib::Thread* thread_;
|
||||
int id_;
|
||||
unsigned int progress_;
|
||||
Glib::Dispatcher signal_increment_;
|
||||
sigc::signal<void> signal_finished_;
|
||||
|
||||
void progress_increment();
|
||||
void thread_function();
|
||||
|
||||
mutable int ref_count_;
|
||||
|
||||
};
|
||||
|
||||
class Application : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
Application();
|
||||
virtual ~Application();
|
||||
|
||||
void launch_threads();
|
||||
void run();
|
||||
|
||||
private:
|
||||
Glib::RefPtr<Glib::MainLoop> main_loop_;
|
||||
std::list<ThreadProgress*> progress_list_;
|
||||
std::list<Glib::RefPtr<ThreadProgress> > progress_ref_list_;
|
||||
|
||||
void on_progress_finished(ThreadProgress* thread_progress);
|
||||
};
|
||||
|
||||
|
||||
ThreadProgress::ThreadProgress(int id)
|
||||
:
|
||||
thread_ (0),
|
||||
id_ (id),
|
||||
progress_ (0),
|
||||
ref_count_(0)
|
||||
{
|
||||
// Increment the reference count
|
||||
reference();
|
||||
// Connect to the cross-thread signal.
|
||||
signal_increment_.connect(sigc::mem_fun(*this, &ThreadProgress::progress_increment));
|
||||
}
|
||||
|
||||
ThreadProgress::~ThreadProgress()
|
||||
{}
|
||||
|
||||
void ThreadProgress::launch()
|
||||
{
|
||||
// Create a joinable thread.
|
||||
thread_ = Glib::Thread::create(sigc::mem_fun(*this, &ThreadProgress::thread_function), true);
|
||||
}
|
||||
|
||||
void ThreadProgress::join()
|
||||
{
|
||||
thread_->join();
|
||||
}
|
||||
|
||||
sigc::signal<void>& ThreadProgress::signal_finished()
|
||||
{
|
||||
return signal_finished_;
|
||||
}
|
||||
|
||||
int ThreadProgress::id() const
|
||||
{
|
||||
return id_;
|
||||
}
|
||||
|
||||
void ThreadProgress::progress_increment()
|
||||
{
|
||||
// Use an integer because floating point arithmetic is inaccurate --
|
||||
// we want to finish *exactly* after the 100th increment.
|
||||
++progress_;
|
||||
|
||||
std::cout << "Thread " << id_ << ": " << progress_ << '%' << std::endl;
|
||||
|
||||
if(progress_ >= 100)
|
||||
signal_finished_();
|
||||
}
|
||||
|
||||
void ThreadProgress::thread_function()
|
||||
{
|
||||
Glib::Rand rand;
|
||||
int usecs = 5000;
|
||||
|
||||
for(int i = 0; i < 100; ++i)
|
||||
{
|
||||
usecs = rand.get_int_range(std::max(0, usecs - 1000 - i), std::min(20000, usecs + 1000 + i));
|
||||
Glib::usleep(usecs);
|
||||
|
||||
// Tell the main thread to increment the progress value.
|
||||
signal_increment_();
|
||||
}
|
||||
}
|
||||
|
||||
Application::Application()
|
||||
:
|
||||
main_loop_ (Glib::MainLoop::create())
|
||||
{
|
||||
std::cout << "Thread Dispatcher Example." << std::endl;
|
||||
|
||||
for(int i = 1; i <= 5; ++i)
|
||||
{
|
||||
ThreadProgress* progress=new ThreadProgress(i);
|
||||
progress_list_.push_back(progress);
|
||||
progress_ref_list_.push_back(Glib::RefPtr<ThreadProgress>(progress));
|
||||
|
||||
progress->signal_finished().connect(
|
||||
sigc::bind<1>(sigc::mem_fun(*this, &Application::on_progress_finished), progress));
|
||||
}
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
{
|
||||
}
|
||||
|
||||
void Application::launch_threads()
|
||||
{
|
||||
std::for_each(progress_list_.begin(), progress_list_.end(),
|
||||
std::mem_fun(&ThreadProgress::launch));
|
||||
}
|
||||
|
||||
void Application::run()
|
||||
{
|
||||
main_loop_->run();
|
||||
}
|
||||
|
||||
void Application::on_progress_finished(ThreadProgress* thread_progress)
|
||||
{
|
||||
{
|
||||
progress_list_.remove(thread_progress);
|
||||
thread_progress->join();
|
||||
|
||||
std::cout << "Thread " << thread_progress->id()
|
||||
<< ": finished." << std::endl;
|
||||
}
|
||||
|
||||
if(progress_list_.empty())
|
||||
main_loop_->quit();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
Glib::thread_init();
|
||||
|
||||
Application application;
|
||||
|
||||
// Install a one-shot idle handler to launch the threads
|
||||
Glib::signal_idle().connect(
|
||||
sigc::bind_return(sigc::mem_fun(application, &Application::launch_threads), false));
|
||||
|
||||
application.run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
232
libs/glibmm2/examples/thread/dispatcher2.cc
Normal file
232
libs/glibmm2/examples/thread/dispatcher2.cc
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
/*
|
||||
* original Glib::Dispatcher example -- cross thread signalling
|
||||
* by Daniel Elstner <daniel.elstner@gmx.net>
|
||||
*
|
||||
* Modified by Stephan Puchegger <stephan.puchegger@ap.univie.ac.at>
|
||||
* to contain 2 mainloops in 2 different threads, that communicate
|
||||
* via cross thread signalling in both directions. The timer thread
|
||||
* sends the UI thread a cross thread signal every second, which in turn
|
||||
* updates the label stating how many seconds have passed since the start
|
||||
* of the program.
|
||||
*
|
||||
* Modified by J. Abelardo Gutierrez <jabelardo@cantv.net>
|
||||
* to cast all gtkmm out and make it glimm only
|
||||
*
|
||||
* Note: This example is special stuff that's seldomly needed by the
|
||||
* vast majority of applications. Don't bother working out what this
|
||||
* code does unless you know for sure you need 2 main loops running in
|
||||
* 2 distinct main contexts.
|
||||
*
|
||||
* Copyright (c) 2002-2003 Free Software Foundation
|
||||
*/
|
||||
|
||||
#include <glibmm.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
Glib::RefPtr<Glib::MainLoop> main_loop;
|
||||
|
||||
class ThreadTimer : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
ThreadTimer();
|
||||
~ThreadTimer();
|
||||
|
||||
void launch();
|
||||
void signal_finished_emit();
|
||||
void print() const;
|
||||
|
||||
typedef sigc::signal<void> type_signal_end;
|
||||
static type_signal_end& signal_end();
|
||||
|
||||
private:
|
||||
unsigned int time_;
|
||||
Glib::Dispatcher signal_increment_;
|
||||
Glib::Dispatcher* signal_finished_ptr_;
|
||||
|
||||
Glib::Mutex startup_mutex_;
|
||||
Glib::Cond startup_cond_;
|
||||
Glib::Thread* thread_;
|
||||
|
||||
static type_signal_end signal_end_;
|
||||
|
||||
void timer_increment();
|
||||
bool timeout_handler();
|
||||
static void finished_handler(Glib::RefPtr<Glib::MainLoop> mainloop);
|
||||
void thread_function();
|
||||
};
|
||||
|
||||
//TODO: Rename to avoid confusion with Glib::Dispatcher. murrayc
|
||||
class Dispatcher : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
Dispatcher();
|
||||
|
||||
void launch_thread();
|
||||
void end();
|
||||
|
||||
private:
|
||||
ThreadTimer* timer_;
|
||||
};
|
||||
|
||||
ThreadTimer::ThreadTimer()
|
||||
:
|
||||
time_ (0),
|
||||
// Create a new dispatcher that is attached to the default main context,
|
||||
signal_increment_ (),
|
||||
// This pointer will be initialized later by the 2nd thread.
|
||||
signal_finished_ptr_ (NULL)
|
||||
{
|
||||
// Connect the cross-thread signal.
|
||||
signal_increment_.connect(sigc::mem_fun(*this, &ThreadTimer::timer_increment));
|
||||
}
|
||||
|
||||
ThreadTimer::~ThreadTimer()
|
||||
{}
|
||||
|
||||
void ThreadTimer::launch()
|
||||
{
|
||||
// Unfortunately, the thread creation has to be fully synchronized in
|
||||
// order to access the Dispatcher object instantiated by the 2nd thread.
|
||||
// So, let's do some kind of hand-shake using a mutex and a condition
|
||||
// variable.
|
||||
Glib::Mutex::Lock lock (startup_mutex_);
|
||||
|
||||
// Create a joinable thread -- it needs to be joined, otherwise it's a memory leak.
|
||||
thread_ = Glib::Thread::create(
|
||||
sigc::mem_fun(*this, &ThreadTimer::thread_function), true);
|
||||
|
||||
// Wait for the 2nd thread's startup notification.
|
||||
while(signal_finished_ptr_ == NULL)
|
||||
startup_cond_.wait(startup_mutex_);
|
||||
}
|
||||
|
||||
void ThreadTimer::signal_finished_emit()
|
||||
{
|
||||
// Cause the 2nd thread's main loop to quit.
|
||||
signal_finished_ptr_->emit();
|
||||
|
||||
// wait for the thread to join
|
||||
if(thread_ != NULL)
|
||||
thread_->join();
|
||||
|
||||
signal_finished_ptr_ = NULL;
|
||||
}
|
||||
|
||||
void ThreadTimer::print() const
|
||||
{
|
||||
std::cout << time_ << " seconds since start" << std::endl;
|
||||
}
|
||||
|
||||
sigc::signal< void >& ThreadTimer::signal_end()
|
||||
{
|
||||
return signal_end_;
|
||||
}
|
||||
|
||||
void ThreadTimer::timer_increment()
|
||||
{
|
||||
// another second has passed since the start of the program
|
||||
++time_;
|
||||
print();
|
||||
|
||||
if(time_ >= 10)
|
||||
signal_finished_emit();
|
||||
}
|
||||
|
||||
// static
|
||||
void ThreadTimer::finished_handler(Glib::RefPtr<Glib::MainLoop> mainloop)
|
||||
{
|
||||
// quit the timer thread mainloop
|
||||
mainloop->quit();
|
||||
std::cout << "timer thread mainloop finished" << std::endl;
|
||||
ThreadTimer::signal_end().emit();
|
||||
}
|
||||
|
||||
bool ThreadTimer::timeout_handler()
|
||||
{
|
||||
// inform the printing thread that another second has passed
|
||||
signal_increment_();
|
||||
|
||||
// this timer should stay alive
|
||||
return true;
|
||||
}
|
||||
|
||||
void ThreadTimer::thread_function()
|
||||
{
|
||||
// create a new Main Context
|
||||
Glib::RefPtr<Glib::MainContext> context = Glib::MainContext::create();
|
||||
// create a new Main Loop
|
||||
Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(context, true);
|
||||
|
||||
// attach a timeout handler, that is called every second, to the
|
||||
// newly created MainContext
|
||||
context->signal_timeout().connect(sigc::mem_fun(*this, &ThreadTimer::timeout_handler), 1000);
|
||||
|
||||
// We need to lock while creating the Dispatcher instance,
|
||||
// in order to ensure memory visibility.
|
||||
Glib::Mutex::Lock lock (startup_mutex_);
|
||||
|
||||
// create a new dispatcher, that is connected to the newly
|
||||
// created MainContext
|
||||
Glib::Dispatcher signal_finished (context);
|
||||
|
||||
signal_finished.connect(sigc::bind(sigc::ptr_fun(&ThreadTimer::finished_handler), mainloop));
|
||||
|
||||
signal_finished_ptr_ = &signal_finished;
|
||||
|
||||
// Tell the launcher thread that everything is in place now.
|
||||
startup_cond_.signal();
|
||||
lock.release();
|
||||
|
||||
// start the mainloop
|
||||
mainloop->run();
|
||||
}
|
||||
|
||||
// initialize static member:
|
||||
ThreadTimer::type_signal_end ThreadTimer::signal_end_;
|
||||
|
||||
Dispatcher::Dispatcher()
|
||||
:
|
||||
timer_ (NULL)
|
||||
{
|
||||
std::cout << "Thread Dispatcher Example #2" << std::endl;
|
||||
|
||||
timer_ = new ThreadTimer();
|
||||
timer_->signal_end().connect(sigc::mem_fun(*this, &Dispatcher::end));
|
||||
timer_->print();
|
||||
}
|
||||
|
||||
void Dispatcher::launch_thread()
|
||||
{
|
||||
// launch the timer thread
|
||||
timer_->launch();
|
||||
}
|
||||
|
||||
void Dispatcher::end()
|
||||
{
|
||||
// quit the main mainloop
|
||||
main_loop->quit();
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
Glib::thread_init();
|
||||
main_loop = Glib::MainLoop::create();
|
||||
|
||||
Dispatcher dispatcher;
|
||||
|
||||
// Install a one-shot idle handler to launch the threads
|
||||
Glib::signal_idle().connect(
|
||||
sigc::bind_return(sigc::mem_fun(dispatcher, &Dispatcher::launch_thread), false));
|
||||
|
||||
main_loop->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
113
libs/glibmm2/examples/thread/thread.cc
Normal file
113
libs/glibmm2/examples/thread/thread.cc
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <queue>
|
||||
#include <glibmm/random.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <glibmm/timer.h>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
class MessageQueue : public sigc::trackable
|
||||
{
|
||||
public:
|
||||
MessageQueue();
|
||||
~MessageQueue();
|
||||
|
||||
void producer();
|
||||
void consumer();
|
||||
|
||||
private:
|
||||
Glib::Mutex mutex_;
|
||||
Glib::Cond cond_push_;
|
||||
Glib::Cond cond_pop_;
|
||||
std::queue<int> queue_;
|
||||
};
|
||||
|
||||
|
||||
MessageQueue::MessageQueue()
|
||||
{}
|
||||
|
||||
MessageQueue::~MessageQueue()
|
||||
{}
|
||||
|
||||
void MessageQueue::producer()
|
||||
{
|
||||
Glib::Rand rand (1234);
|
||||
|
||||
for(int i = 0; i < 200; ++i)
|
||||
{
|
||||
{
|
||||
Glib::Mutex::Lock lock (mutex_);
|
||||
|
||||
while(queue_.size() >= 64)
|
||||
cond_pop_.wait(mutex_);
|
||||
|
||||
queue_.push(i);
|
||||
std::cout << '*';
|
||||
std::cout.flush();
|
||||
|
||||
cond_push_.signal();
|
||||
}
|
||||
|
||||
if(rand.get_bool())
|
||||
continue;
|
||||
|
||||
Glib::usleep(rand.get_int_range(0, 100000));
|
||||
}
|
||||
}
|
||||
|
||||
void MessageQueue::consumer()
|
||||
{
|
||||
Glib::Rand rand (4567);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
{
|
||||
Glib::Mutex::Lock lock (mutex_);
|
||||
|
||||
while(queue_.empty())
|
||||
cond_push_.wait(mutex_);
|
||||
|
||||
const int i = queue_.front();
|
||||
queue_.pop();
|
||||
std::cout << "\x08 \x08";
|
||||
std::cout.flush();
|
||||
|
||||
cond_pop_.signal();
|
||||
|
||||
if(i >= 199)
|
||||
break;
|
||||
}
|
||||
|
||||
if(rand.get_bool())
|
||||
continue;
|
||||
|
||||
Glib::usleep(rand.get_int_range(10000, 200000));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
Glib::thread_init();
|
||||
|
||||
MessageQueue queue;
|
||||
|
||||
Glib::Thread *const producer = Glib::Thread::create(
|
||||
sigc::mem_fun(queue, &MessageQueue::producer), true);
|
||||
|
||||
Glib::Thread *const consumer = Glib::Thread::create(
|
||||
sigc::mem_fun(queue, &MessageQueue::consumer), true);
|
||||
|
||||
producer->join();
|
||||
consumer->join();
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
49
libs/glibmm2/examples/thread/threadpool.cc
Normal file
49
libs/glibmm2/examples/thread/threadpool.cc
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <glibmm/random.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <glibmm/threadpool.h>
|
||||
#include <glibmm/timer.h>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
Glib::StaticMutex mutex = GLIBMM_STATIC_MUTEX_INIT;
|
||||
|
||||
void print_char(char c)
|
||||
{
|
||||
Glib::Rand rand;
|
||||
|
||||
for(int i = 0; i < 100; ++i)
|
||||
{
|
||||
{
|
||||
Glib::Mutex::Lock lock (mutex);
|
||||
std::cout << c;
|
||||
std::cout.flush();
|
||||
}
|
||||
Glib::usleep(rand.get_int_range(10000, 100000));
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
Glib::thread_init();
|
||||
|
||||
Glib::ThreadPool pool (10);
|
||||
|
||||
for(char c = 'a'; c <= 'z'; ++c)
|
||||
{
|
||||
pool.push(sigc::bind<1>(sigc::ptr_fun(&print_char), c));
|
||||
}
|
||||
|
||||
pool.shutdown();
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue