XBT:
* Make the backtrace of exceptions more human readable [Mt]
+ * New module: xbt/str [Mt]
+ a ton of string utility functions (split, join, printf to a newly
+ allocated buffer, trim, etc)
* New module: xbt/synchro [Mt]
synchronization tools (mutex and conditions) working the same way
in simulation and in real life (mainly useful for GRAS, but not
only).
- * New module: xbt/str [Mt]
- a ton of string utility functions (split, join, printf to a newly
- allocated buffer, trim, etc)
+ * New module: xbt/queue [Mt]
+ classical producer/consumer synchronization scheme
--
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006 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.
# It is intended to be included in all Makefile.am
-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
all2all.$(OBJEXT)
all2all_simulator_OBJECTS = $(am_all2all_simulator_OBJECTS)
all2all_simulator_DEPENDENCIES = $(top_builddir)/src/libsimgrid.la
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src
+DEFAULT_INCLUDES = -I. -I$(top_builddir)/src@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
- $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
SOURCES = $(all2all_receiver_SOURCES) $(all2all_sender_SOURCES) \
$(all2all_simulator_SOURCES)
DIST_SOURCES = $(all2all_receiver_SOURCES) $(all2all_sender_SOURCES) \
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADDR2LINE = @ADDR2LINE@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AM_CFLAGS = @AM_CFLAGS@
AR = @AR@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FLEXML = @FLEXML@
-GRAMINE_MODE_FALSE = @GRAMINE_MODE_FALSE@
-GRAMINE_MODE_TRUE = @GRAMINE_MODE_TRUE@
-GRAS_ARCH_32_BITS_FALSE = @GRAS_ARCH_32_BITS_FALSE@
-GRAS_ARCH_32_BITS_TRUE = @GRAS_ARCH_32_BITS_TRUE@
+GCJ = @GCJ@
+GCJDEPMODE = @GCJDEPMODE@
+GCJFLAGS = @GCJFLAGS@
GRAS_DEP = @GRAS_DEP@
GREP = @GREP@
GTNETS_CFLAGS = @GTNETS_CFLAGS@
GTNETS_LDFLAGS = @GTNETS_LDFLAGS@
-HAVE_FLEXML_FALSE = @HAVE_FLEXML_FALSE@
-HAVE_FLEXML_TRUE = @HAVE_FLEXML_TRUE@
-HAVE_SDP_FALSE = @HAVE_SDP_FALSE@
-HAVE_SDP_TRUE = @HAVE_SDP_TRUE@
+INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAR = @JAR@
+JAVA = @JAVA@
+JAVAC = @JAVAC@
LDFLAGS = @LDFLAGS@
LD_DYNAMIC_FLAGS = @LD_DYNAMIC_FLAGS@
LEX = @LEX@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
MD5SUM = @MD5SUM@
+MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
SHELL = @SHELL@
SIMGRID_DEP = @SIMGRID_DEP@
STRIP = @STRIP@
-USE_GTNETS_FALSE = @USE_GTNETS_FALSE@
-USE_GTNETS_TRUE = @USE_GTNETS_TRUE@
VERSION = @VERSION@
WARNING = @WARNING@
abs_builddir = @abs_builddir@
ac_configure_args = @ac_configure_args@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-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@
build_id = @build_id@
build_os = @build_os@
build_vendor = @build_vendor@
+builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
pth_sksize_makecontext = @pth_sksize_makecontext@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir)/include
EXTRA_DIST = all2all.xml test_rl test_sg_32 test_sg_64
@GRAS_ARCH_32_BITS_FALSE@TESTS = test_sg_64 test_rl
done
all2all_receiver$(EXEEXT): $(all2all_receiver_OBJECTS) $(all2all_receiver_DEPENDENCIES)
@rm -f all2all_receiver$(EXEEXT)
- $(LINK) $(all2all_receiver_LDFLAGS) $(all2all_receiver_OBJECTS) $(all2all_receiver_LDADD) $(LIBS)
+ $(LINK) $(all2all_receiver_OBJECTS) $(all2all_receiver_LDADD) $(LIBS)
all2all_sender$(EXEEXT): $(all2all_sender_OBJECTS) $(all2all_sender_DEPENDENCIES)
@rm -f all2all_sender$(EXEEXT)
- $(LINK) $(all2all_sender_LDFLAGS) $(all2all_sender_OBJECTS) $(all2all_sender_LDADD) $(LIBS)
+ $(LINK) $(all2all_sender_OBJECTS) $(all2all_sender_LDADD) $(LIBS)
all2all_simulator$(EXEEXT): $(all2all_simulator_OBJECTS) $(all2all_simulator_DEPENDENCIES)
@rm -f all2all_simulator$(EXEEXT)
- $(LINK) $(all2all_simulator_LDFLAGS) $(all2all_simulator_OBJECTS) $(all2all_simulator_LDADD) $(LIBS)
+ $(LINK) $(all2all_simulator_OBJECTS) $(all2all_simulator_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/all2all.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
-@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
-@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
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 \
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
- @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
srcdir=$(srcdir); export srcdir; \
- list='$(TESTS)'; \
+ list=' $(TESTS) '; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
+ *$$ws$$tst$$ws*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *" $$tst "*) \
+ *$$ws$$tst$$ws*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
else :; fi
distdir: $(DISTFILES)
- $(mkdir_p) $(distdir)/../../../acmacro $(distdir)/../../../examples $(distdir)/../../../examples/gras
- @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; \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
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 \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-libtool distclean-tags
+ distclean-tags
dvi: dvi-am
install-data-am:
+install-dvi: install-dvi-am
+
install-exec-am:
+install-html: install-html-am
+
install-info: install-info-am
install-man:
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
installcheck-am:
maintainer-clean: maintainer-clean-am
ps-am:
-uninstall-am: uninstall-info-am
+uninstall-am:
+
+.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS 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-exec install-exec-am install-info \
- install-info-am install-man install-strip installcheck \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am 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
+ tags uninstall uninstall-am
@GRAS_ARCH_32_BITS_TRUE@test-sg:
@GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32
xbt/graphxml.h \
\
xbt/synchro.h \
+ xbt/queue.h \
\
msg/msg.h \
msg/datatypes.h \
xbt/graphxml.h \
\
xbt/synchro.h \
+ xbt/queue.h \
\
msg/msg.h \
msg/datatypes.h \
--- /dev/null
+/* $Id$ */
+
+/* A (synchronized) message queue. */
+/* Popping an empty queue is blocking, as well as pushing a full one */
+
+/* Copyright (c) 2007 Martin Quinson. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef _XBT_QUEUE_H
+#define _XBT_QUEUE_H
+
+#include "xbt/misc.h" /* SG_BEGIN_DECL */
+//#include "xbt/function_types.h"
+
+SG_BEGIN_DECL()
+
+/** @addtogroup XBT_queue
+ * @brief Synchronized message exchanging queue.
+ *
+ * These is the classical producer/consumer synchronization scheme, which all concurrent programmer recode one day or another.
+ *
+ * For performance concerns, the content of queue must be homogeneous,
+ * just like dynars (see the \ref XBT_dynar section). Indeed, queues use a
+ * dynar to store the data, and add the synchronization on top of it.
+ *
+ * @{
+ */
+
+ /** \brief Queue data type (opaque type) */
+ typedef struct s_xbt_queue_ *xbt_queue_t;
+
+
+ XBT_PUBLIC(xbt_queue_t) xbt_queue_new(int capacity, unsigned long elm_size);
+ XBT_PUBLIC(void) xbt_queue_free(xbt_queue_t *queue);
+
+ XBT_PUBLIC(unsigned long) xbt_queue_length(const xbt_queue_t queue);
+
+ XBT_PUBLIC(void) xbt_queue_push (xbt_queue_t queue, const void *src);
+ XBT_PUBLIC(void) xbt_queue_pop (xbt_queue_t queue, void *const dst);
+ XBT_PUBLIC(void) xbt_queue_unshift (xbt_queue_t queue, const void *src);
+ XBT_PUBLIC(void) xbt_queue_shift (xbt_queue_t queue, void *const dst);
+
+SG_END_DECL()
+
+#endif /* _XBT_QUEUE_H */
xbt/graph.c \
xbt/set.c \
xbt/xbt_matrix.c \
+ \
+ xbt/queue.c \
+ \
xbt/xbt_peer.c \
+ \
xbt/xbt_main.c \
+ \
xbt/config.c \
xbt/cunit.c \
xbt/graphxml_parse.c
xbt_log_layout_simple.lo xbt_log_layout_format.lo \
mallocator.lo dynar.lo dict.lo dict_elm.lo dict_cursor.lo \
dict_multi.lo heap.lo fifo.lo swag.lo graph.lo set.lo \
- xbt_matrix.lo xbt_peer.lo xbt_main.lo config.lo cunit.lo \
- graphxml_parse.lo
+ xbt_matrix.lo queue.lo xbt_peer.lo xbt_main.lo config.lo \
+ cunit.lo graphxml_parse.lo
am__objects_2 = gras.lo transport.lo msg.lo rpc.lo timer.lo process.lo \
gras_module.lo ddt_create.lo ddt_convert.lo ddt_exchange.lo \
cbps.lo datadesc.lo ddt_parse.lo ddt_parse.yy.lo
xbt/xbt_log_layout_simple.c xbt/xbt_log_layout_format.c \
xbt/mallocator.c xbt/dynar.c xbt/dict.c xbt/dict_elm.c \
xbt/dict_cursor.c xbt/dict_multi.c xbt/heap.c xbt/fifo.c \
- xbt/swag.c xbt/graph.c xbt/set.c xbt/xbt_matrix.c \
+ xbt/swag.c xbt/graph.c xbt/set.c xbt/xbt_matrix.c xbt/queue.c \
xbt/xbt_peer.c xbt/xbt_main.c xbt/config.c xbt/cunit.c \
xbt/graphxml_parse.c surf/maxmin.c surf/lagrange.c \
surf/trace_mgr.c surf/surf.c surf/surfxml_parse.c surf/cpu.c \
xbt/xbt_log_layout_format.c xbt/mallocator.c xbt/dynar.c \
xbt/dict.c xbt/dict_elm.c xbt/dict_cursor.c xbt/dict_multi.c \
xbt/heap.c xbt/fifo.c xbt/swag.c xbt/graph.c xbt/set.c \
- xbt/xbt_matrix.c xbt/xbt_peer.c xbt/xbt_main.c xbt/config.c \
- xbt/cunit.c xbt/graphxml_parse.c surf/maxmin.c surf/lagrange.c \
- surf/trace_mgr.c surf/surf.c surf/surfxml_parse.c surf/cpu.c \
- surf/network.c surf/workstation.c surf/surf_timer.c \
- surf/network_dassf.c surf/workstation_KCCFLN05.c \
- surf/gtnets/gtnets_simulator.cc surf/gtnets/gtnets_topology.cc \
- surf/gtnets/gtnets_interface.cc surf/network_gtnets.c \
- surf/sdp.c simix/smx_global.c simix/smx_deployment.c \
- simix/smx_config.c simix/smx_environment.c simix/smx_host.c \
- simix/smx_process.c simix/smx_action.c simix/smx_synchro.c \
- java/jxbt_context.c java/jxbt_context.h xbt/xbt_os_thread.c \
- java/jxbt_utilities.c java/jxbt_utilities.h java/jmsg.c \
- java/jmsg.h java/jmsg_channel.c java/jmsg_channel.h \
- java/jmsg_host.c java/jmsg_host.h java/jmsg_parallel_task.c \
+ xbt/xbt_matrix.c xbt/queue.c xbt/xbt_peer.c xbt/xbt_main.c \
+ xbt/config.c xbt/cunit.c xbt/graphxml_parse.c surf/maxmin.c \
+ surf/lagrange.c surf/trace_mgr.c surf/surf.c \
+ surf/surfxml_parse.c surf/cpu.c surf/network.c \
+ surf/workstation.c surf/surf_timer.c surf/network_dassf.c \
+ surf/workstation_KCCFLN05.c surf/gtnets/gtnets_simulator.cc \
+ surf/gtnets/gtnets_topology.cc surf/gtnets/gtnets_interface.cc \
+ surf/network_gtnets.c surf/sdp.c simix/smx_global.c \
+ simix/smx_deployment.c simix/smx_config.c \
+ simix/smx_environment.c simix/smx_host.c simix/smx_process.c \
+ simix/smx_action.c simix/smx_synchro.c java/jxbt_context.c \
+ java/jxbt_context.h xbt/xbt_os_thread.c java/jxbt_utilities.c \
+ java/jxbt_utilities.h java/jmsg.c java/jmsg.h \
+ java/jmsg_channel.c java/jmsg_channel.h java/jmsg_host.c \
+ java/jmsg_host.h java/jmsg_parallel_task.c \
java/jmsg_parallel_task.h java/jmsg_process.c \
java/jmsg_process.h java/jmsg_task.c java/jmsg_task.h \
msg/msg_config.c msg/task.c msg/host.c msg/m_process.c \
xbt/graph.c \
xbt/set.c \
xbt/xbt_matrix.c \
+ \
+ xbt/queue.c \
+ \
xbt/xbt_peer.c \
+ \
xbt/xbt_main.c \
+ \
xbt/config.c \
xbt/cunit.c \
xbt/graphxml_parse.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network_gtnets.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peermanagement.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rl_dns.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rl_emul.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rl_msg.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xbt_matrix.lo `test -f 'xbt/xbt_matrix.c' || echo '$(srcdir)/'`xbt/xbt_matrix.c
+queue.lo: xbt/queue.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT queue.lo -MD -MP -MF $(DEPDIR)/queue.Tpo -c -o queue.lo `test -f 'xbt/queue.c' || echo '$(srcdir)/'`xbt/queue.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/queue.Tpo $(DEPDIR)/queue.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xbt/queue.c' object='queue.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o queue.lo `test -f 'xbt/queue.c' || echo '$(srcdir)/'`xbt/queue.c
+
xbt_peer.lo: xbt/xbt_peer.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xbt_peer.lo -MD -MP -MF $(DEPDIR)/xbt_peer.Tpo -c -o xbt_peer.lo `test -f 'xbt/xbt_peer.c' || echo '$(srcdir)/'`xbt/xbt_peer.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xbt_peer.Tpo $(DEPDIR)/xbt_peer.Plo
--- /dev/null
+/* $Id$ */
+
+/* A (synchronized) message queue. */
+/* Popping an empty queue is blocking, as well as pushing a full one */
+
+/* Copyright (c) 2007 Martin Quinson. All rights reserved. */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "xbt/misc.h"
+#include "xbt/sysdep.h"
+#include "xbt/log.h"
+//#include "xbt/ex.h"
+#include "xbt/dynar.h"
+
+#include "xbt/synchro.h"
+#include "xbt/queue.h" /* this module */
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue,xbt,"Message exchanging queue");
+
+typedef struct s_xbt_queue_ {
+ int capacity;
+ xbt_dynar_t data;
+ xbt_mutex_t mutex;
+ xbt_cond_t not_full, not_empty;
+} s_xbt_queue_t;
+
+/** @brief Create a new message exchange queue.
+ *
+ * @param capacity the capacity of the queue. If non-nul, any attempt to push an item which would let the size of the queue over this number will be blocking until someone else pop some data
+ * @param elm_size size of each element stored in it (see #xbt_dynar_new)
+ */
+xbt_queue_t xbt_queue_new(int capacity,unsigned long elm_size) {
+ xbt_queue_t res = xbt_new0(s_xbt_queue_t,1);
+ xbt_assert0(capacity>=0,"Capacity cannot be negative");
+
+ res->capacity = capacity;
+ res->data = xbt_dynar_new(elm_size,NULL);
+ res->mutex = xbt_mutex_init();
+ res->not_full = xbt_cond_init();
+ res->not_empty = xbt_cond_init();
+ return res;
+}
+/** @brief Destroy a message exchange queue.
+ *
+ * Any remaining content is leaked.
+ */
+void xbt_queue_free(xbt_queue_t *queue) {
+
+ xbt_dynar_free(&( (*queue)->data ));
+ xbt_mutex_destroy( (*queue)->mutex );
+ xbt_cond_destroy( (*queue)->not_full );
+ xbt_cond_destroy( (*queue)->not_empty );
+ free((*queue));
+ *queue = NULL;
+}
+
+/** @brief Get the queue size */
+unsigned long xbt_queue_length(xbt_queue_t queue) {
+ unsigned long res;
+ xbt_mutex_lock(queue->mutex);
+ res=xbt_dynar_length(queue->data);
+ xbt_mutex_unlock(queue->mutex);
+ return res;
+}
+
+/** @brief Push something to the message exchange queue.
+ *
+ * This is blocking if the declared capacity is non-nul, and if this amount is reached.
+ *
+ * @seealso #xbt_dynar_push
+ */
+void xbt_queue_push(xbt_queue_t queue, const void *src) {
+ xbt_mutex_lock(queue->mutex);
+ while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
+ DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
+ xbt_cond_wait(queue->not_full,queue->mutex);
+ }
+ xbt_dynar_push(queue->data,src);
+ xbt_cond_signal(queue->not_empty);
+}
+
+
+/** @brief Pop something from the message exchange queue.
+ *
+ * This is blocking if the queue is empty.
+ *
+ * @seealso #xbt_dynar_pop
+ *
+ */
+void xbt_queue_pop(xbt_queue_t queue, void* const dst) {
+ xbt_mutex_lock(queue->mutex);
+ while (xbt_dynar_length(queue->data) == 0) {
+ DEBUG1("Queue %p empty. Waiting",queue);
+ xbt_cond_wait(queue->not_empty,queue->mutex);
+ }
+ xbt_dynar_pop(queue->data,dst);
+ xbt_cond_signal(queue->not_full);
+}
+
+/** @brief Unshift something to the message exchange queue.
+ *
+ * This is blocking if the declared capacity is non-nul, and if this amount is reached.
+ *
+ * @seealso #xbt_dynar_unshift
+ */
+void xbt_queue_unshift(xbt_queue_t queue, const void *src) {
+ xbt_mutex_lock(queue->mutex);
+ while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
+ DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
+ xbt_cond_wait(queue->not_full,queue->mutex);
+ }
+ xbt_dynar_unshift(queue->data,src);
+ xbt_cond_signal(queue->not_empty);
+}
+
+
+/** @brief Shift something from the message exchange queue.
+ *
+ * This is blocking if the queue is empty.
+ *
+ * @seealso #xbt_dynar_shift
+ *
+ */
+void xbt_queue_shift(xbt_queue_t queue, void* const dst) {
+ xbt_mutex_lock(queue->mutex);
+ while (xbt_dynar_length(queue->data) == 0) {
+ DEBUG1("Queue %p empty. Waiting",queue);
+ xbt_cond_wait(queue->not_empty,queue->mutex);
+ }
+ xbt_dynar_shift(queue->data,dst);
+ xbt_cond_signal(queue->not_full);
+}