changeset 13:f06fb0370caf

add pthread code that has not been debuged yet.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 08 Jan 2010 20:00:01 +0900
parents 12ed3c43795a
children 5f65da34f4f3
files Makefile.am Makefile.in configure configure.ac examples/Makefile.am examples/Makefile.in examples/test.c examples/treedependtask/Makefile examples/treedependtask/testmanager examples/treedependtask/testmanager.cbc src/Debug.h src/Fifo/TaskManager.cbc src/Fifo/TaskManager.h src/Makefile.am src/Makefile.in src/TaskManagerAbst.cbc src/pthread/TaskManager.cbc src/pthread/TaskManager.h src/pthread/ThreadManager.cbc src/pthread/ThreadManager.h src/taskinit.cbc src/taskinit.h src/userinclude/CbCTaskManager.h
diffstat 23 files changed, 728 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Fri Jan 08 14:51:19 2010 +0900
+++ b/Makefile.am	Fri Jan 08 20:00:01 2010 +0900
@@ -1,2 +1,2 @@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src
+SUBDIRS = src examples
--- a/Makefile.in	Fri Jan 08 14:51:19 2010 +0900
+++ b/Makefile.in	Fri Jan 08 20:00:01 2010 +0900
@@ -160,7 +160,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = src
+SUBDIRS = src examples
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
--- a/configure	Fri Jan 08 14:51:19 2010 +0900
+++ b/configure	Fri Jan 08 20:00:01 2010 +0900
@@ -5694,7 +5694,7 @@
 
 
 
-ac_config_files="$ac_config_files Makefile src/Makefile"
+ac_config_files="$ac_config_files Makefile src/Makefile examples/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -6354,6 +6354,7 @@
     "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
 
   *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
--- a/configure.ac	Fri Jan 08 14:51:19 2010 +0900
+++ b/configure.ac	Fri Jan 08 20:00:01 2010 +0900
@@ -60,6 +60,6 @@
 
 
 
-AC_CONFIG_FILES([Makefile src/Makefile])
+AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile])
 AC_OUTPUT
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/Makefile.am	Fri Jan 08 20:00:01 2010 +0900
@@ -0,0 +1,16 @@
+
+CbCCOMPILE = $(CbCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	     $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+.cbc.o:
+	$(CbCCOMPILE) -c -o $@ $<
+
+lib_LIBRARIES = 
+
+EXTRA_PROGRAMS = treedependtask/testmanager
+treedependtask_testmanager_SOURCES = test.c treedependtask/testmanager.cbc treedependtask/taskinit.cbc
+#testmanager_LDADD = ../src/libTaskManager.a
+LDADD = ../src/libTaskManager.a
+AM_CPPFLAGS = -I$(top_srcdir)/src/userinclude
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/Makefile.in	Fri Jan 08 20:00:01 2010 +0900
@@ -0,0 +1,454 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = :
+EXTRA_PROGRAMS = treedependtask/testmanager$(EXEEXT)
+subdir = examples
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)"
+libLIBRARIES_INSTALL = $(INSTALL_DATA)
+LIBRARIES = $(lib_LIBRARIES)
+am__dirstamp = $(am__leading_dot)dirstamp
+am_treedependtask_testmanager_OBJECTS = test.$(OBJEXT) \
+	treedependtask/testmanager.$(OBJEXT) \
+	treedependtask/taskinit.$(OBJEXT)
+treedependtask_testmanager_OBJECTS =  \
+	$(am_treedependtask_testmanager_OBJECTS)
+treedependtask_testmanager_LDADD = $(LDADD)
+treedependtask_testmanager_DEPENDENCIES = ../src/libTaskManager.a
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(treedependtask_testmanager_SOURCES)
+DIST_SOURCES = $(treedependtask_testmanager_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+CbCC = @CbCC@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+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@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+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_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CbCCOMPILE = $(CbCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	     $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+lib_LIBRARIES = 
+treedependtask_testmanager_SOURCES = test.c treedependtask/testmanager.cbc treedependtask/taskinit.cbc
+#testmanager_LDADD = ../src/libTaskManager.a
+LDADD = ../src/libTaskManager.a
+AM_CPPFLAGS = -I$(top_srcdir)/src/userinclude
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cbc .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  examples/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  examples/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:  $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-libLIBRARIES: $(lib_LIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    f=$(am__strip_dir) \
+	    echo " $(libLIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+	    $(libLIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+	  else :; fi; \
+	done
+	@$(POST_INSTALL)
+	@list='$(lib_LIBRARIES)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    p=$(am__strip_dir) \
+	    echo " $(RANLIB) '$(DESTDIR)$(libdir)/$$p'"; \
+	    $(RANLIB) "$(DESTDIR)$(libdir)/$$p"; \
+	  else :; fi; \
+	done
+
+uninstall-libLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LIBRARIES)'; for p in $$list; do \
+	  p=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+	  rm -f "$(DESTDIR)$(libdir)/$$p"; \
+	done
+
+clean-libLIBRARIES:
+	-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
+treedependtask/$(am__dirstamp):
+	@$(MKDIR_P) treedependtask
+	@: > treedependtask/$(am__dirstamp)
+treedependtask/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) treedependtask/$(DEPDIR)
+	@: > treedependtask/$(DEPDIR)/$(am__dirstamp)
+treedependtask/testmanager.$(OBJEXT): treedependtask/$(am__dirstamp) \
+	treedependtask/$(DEPDIR)/$(am__dirstamp)
+treedependtask/taskinit.$(OBJEXT): treedependtask/$(am__dirstamp) \
+	treedependtask/$(DEPDIR)/$(am__dirstamp)
+treedependtask/testmanager$(EXEEXT): $(treedependtask_testmanager_OBJECTS) $(treedependtask_testmanager_DEPENDENCIES) treedependtask/$(am__dirstamp)
+	@rm -f treedependtask/testmanager$(EXEEXT)
+	$(LINK) $(treedependtask_testmanager_OBJECTS) $(treedependtask_testmanager_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+	-rm -f treedependtask/taskinit.$(OBJEXT)
+	-rm -f treedependtask/testmanager.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@
+
+.c.o:
+@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@	$(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) '$<'`
+
+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; nonempty = 1; } \
+	      END { if (nonempty) { 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; nonempty = 1; } \
+	      END { if (nonempty) { 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=; \
+	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; nonempty = 1; } \
+	      END { if (nonempty) { 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)
+	@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; \
+	  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; \
+	    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 $(LIBRARIES)
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+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)
+	-rm -f treedependtask/$(DEPDIR)/$(am__dirstamp)
+	-rm -f treedependtask/$(am__dirstamp)
+
+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-libLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-libLIBRARIES
+
+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
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+	clean-libLIBRARIES ctags distclean distclean-compile \
+	distclean-generic distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-libLIBRARIES 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 pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-libLIBRARIES
+
+
+.cbc.o:
+	$(CbCCOMPILE) -c -o $@ $<
+# 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:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/test.c	Fri Jan 08 20:00:01 2010 +0900
@@ -0,0 +1,6 @@
+
+int
+test()
+{
+	return 0;
+}
--- a/examples/treedependtask/Makefile	Fri Jan 08 14:51:19 2010 +0900
+++ b/examples/treedependtask/Makefile	Fri Jan 08 20:00:01 2010 +0900
@@ -2,15 +2,15 @@
 CbCC = ~/WorkSpace/Mercurial/build_cbc44/INSTALL_DIR/bin/gcc 
 CC = $(CbCC)
 
-TaskManagerDir = ../../CbCTaskManager
+BASEDIR = ../../../build_taskamanger/INSTALL_DIR
 
-LDFLAGS = -L$(TaskManagerDir)
-LIBS = -lFifoManager
+LDFLAGS = -L$(BASEDIR)/lib
+LIBS = -lTaskManager
 
 ENVIRONMENT=Fifo
 #ENVIRONMENT=Cell
 
-INCLUDE = -I$(TaskManagerDir) -I$(TaskManagerDir)/user -I. -I$(TaskManagerDir)/$(ENVIRONMENT)
+INCLUDE = -I$(BASEDIR)/include -I.
 CFLAGS = -Wall -g -O0 $(INCLUDE) -DDEBUG
 
 .SUFFIXES: .cbc .c .o
Binary file examples/treedependtask/testmanager has changed
--- a/examples/treedependtask/testmanager.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/examples/treedependtask/testmanager.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -11,9 +11,9 @@
 
 
 /* it may be moved to TaskManager side.  */
-__code nojob(void *manager, void *rbuff, void *wbuff)
+__code nojob(UserManager *manager, void *rbuff, void *wbuff)
 {
-	goto scheduler(manager, ENDTASK, NULL, NULL);
+	goto manager->scheduler(manager, ENDTASK, NULL, NULL);
 }
 
 
@@ -45,32 +45,34 @@
 	for (i=0; i<NUM; i++) {
 		taskSpawn(manager, tasks[i]);
 	}
-	goto scheduler(manager, ENDTASK, NULL, NULL);
+	goto manager->scheduler(manager, ENDTASK, NULL, NULL);
 }
 
 __code taskA(UserManager *manager, void *rbuff, void *wbuff)
 {
 	__DEBUG("s=%p, rb=%p, wb=%p\n", manager, rbuff, wbuff);
-	goto scheduler(manager, taskA_0, NULL, NULL);
+	//goto taskA_0 (NULL, NULL);
+	//goto scheduler(manager, taskA_0, NULL, NULL);
+	goto manager->scheduler(manager, taskA_0, NULL, NULL);
 }
 __code taskA_0(UserManager *manager, void *rbuff, void *wbuff)
 {
 	__DEBUG("s=%p, rb=%p, wb=%p\n", manager, rbuff, wbuff);
-	goto scheduler(manager, taskA_1, NULL, NULL);
+	goto manager->scheduler(manager, taskA_1, NULL, NULL);
 }
 __code taskA_1(UserManager *manager, void *rbuff, void *wbuff)
 {
 	__DEBUG("s=%p, rb=%p, wb=%p\n", manager, rbuff, wbuff);
-	goto scheduler(manager, taskA_2, NULL, NULL);
+	goto manager->scheduler(manager, taskA_2, NULL, NULL);
 }
 __code taskA_2(UserManager *manager, void *rbuff, void *wbuff)
 {
 	__DEBUG("s=%p, rb=%p, wb=%p\n", manager, rbuff, wbuff);
-	goto scheduler(manager, ENDTASK, NULL, NULL);
+	goto manager->scheduler(manager, ENDTASK, NULL, NULL);
 }
 
 __code taskB(UserManager *manager, void *rbuff, void *wbuff)
 {
 	__DEBUG("s=%p, rb=%p, wb=%p\n", manager, rbuff, wbuff);
-	goto scheduler(manager, taskA_0, NULL, NULL);
+	goto manager->scheduler(manager, taskA_0, NULL, NULL);
 }
--- a/src/Debug.h	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/Debug.h	Fri Jan 08 20:00:01 2010 +0900
@@ -2,19 +2,14 @@
 #define _DEBUG_H
 
 #ifdef DEBUG
-
-#include <stdio.h>
-
-#define __DEBUG(f, args...) \
+  #include <stdio.h>
+  #define __DEBUG(f, args...) \
     fprintf(stderr, "in %s: "f, __FUNCTION__, ## args)
-
-#define __DEBUGnoF(f, args...) \
+  #define __DEBUGnoF(f, args...) \
     fprintf(stderr, f, ## args)
-
 #else
-
-#define __DEBUG(f, args...)
-
+  #define __DEBUG(f, args...)
+  #define __DEBUGnoF(f, args...)
 #endif
 
 #endif /* !_DEBUG_H */
--- a/src/Fifo/TaskManager.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/Fifo/TaskManager.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -2,10 +2,12 @@
 #include "Task.h"
 #include "Debug.h"
 
-/* defined in TaskManagerAbst.  */
-extern Task *createTask(int, char *);
-extern void taskSetData(Task*, void*, int, void*, int);
-extern void taskSpawn(TaskManager*, Task*);
+typedef __code (*Scheduler)(struct _UserManager*,Taskrun,void*,void*);
+typedef struct _UserManager {
+	Scheduler scheduler;
+	TaskManager *manager;
+} UserManager;
+// used only in this file.
 
 /* declarations of code segment.  */
 int main (int argc, char **argv);
@@ -16,8 +18,8 @@
 __code executeTask (TaskManager *manager, ListIter *iter, Task *task);
 __code checkEvent (TaskManager *manager);
 __code checkEvent_real (TaskManager *manager);
-__code selectCode (TaskManager *tsched);
-__code schedEntry (TaskManager *tsched, Taskrun nextcode, void *rbuff, void *wbuff);
+__code selectCode (TaskManager *);
+__code schedEntry (UserManager *, Taskrun, void *, void *);
 
 /* external code segments.  */
 extern __code executed (TaskManager *manager, ListIter *iter, Task *task);
@@ -31,7 +33,7 @@
 
 
 /* Global variable for user task.  */
-__code (*scheduler)(TaskManager*, Taskrun, void*, void*);
+//__code (*scheduler)(TaskManager*, Taskrun, void*, void*);
 
 
 
@@ -49,6 +51,7 @@
 __code
 startTaskManager()
 {
+	/*
 	TaskManager *manager;
 	manager = malloc(sizeof(TaskManager));
 	manager->waitingList = NULL;
@@ -57,6 +60,21 @@
 	manager->running = NULL;
 	scheduler = schedEntry;
 	goto searchStartTask(manager);
+	*/
+
+    TaskManager *manager;
+	UserManager *umanager;
+    manager = malloc(sizeof(TaskManager));
+    umanager= malloc(sizeof(UserManager));
+    manager->waitingList = NULL;
+    manager->activeList = NULL;
+	manager->exitTasks = NULL;
+	manager->running = NULL;
+    manager->user = umanager;
+
+    umanager->manager = manager;
+    umanager->scheduler = schedEntry;
+    goto searchStartTask(manager);
 }
 
 __code
@@ -110,41 +128,42 @@
  *  Scheduler
  */
 __code
-selectCode(TaskManager *tsched)
+selectCode(TaskManager *manager)
 {
 	SchedTask *task;
-	if (tsched->schedTasks) {
-		task = (SchedTask*)_listGetLastData(tsched->schedTasks);
-		tsched->running = task;
+	if (manager->schedTasks) {
+		task = (SchedTask*)_listGetLastData(manager->schedTasks);
+		manager->running = task;
 
 		/* goto user-defined task.  */
-		goto task->nextcode(tsched, task->task->rbuff, task->task->wbuff);
+		goto task->nextcode(manager->user, task->task->rbuff, task->task->wbuff);
 	} else {
 		/* no task we have.  */
 		//goto checkNewCode();
-		goto checkEvent_real(tsched);
+		goto checkEvent_real(manager);
 	}
 }
 
 __code
-schedEntry(TaskManager *tsched, Taskrun nextcode, void *rbuff, void *wbuff)
+schedEntry(UserManager *user, Taskrun nextcode, void *rbuff, void *wbuff)
 {
+	TaskManager *manager = user->manager;
 	/* schedulerd  */
 	if ( nextcode==NULL ) {
 		/* the task finished.  */
-		tsched->schedTasks =
-			_listRemove(tsched->schedTasks, tsched->running);
-		tsched->exitTasks =
-			_listAddFirst(tsched->exitTasks, tsched->running);
-		goto selectCode(tsched);
+		manager->schedTasks =
+			_listRemove(manager->schedTasks, manager->running);
+		manager->exitTasks =
+			_listAddFirst(manager->exitTasks, manager->running);
+		goto selectCode(manager);
 	} else {
 		/* save the next code segment for the task.  */
-		tsched->running->nextcode = nextcode;
-		tsched->running->rbuff = rbuff;
-		tsched->running->wbuff = wbuff;
+		manager->running->nextcode = nextcode;
+		manager->running->rbuff = rbuff;
+		manager->running->wbuff = wbuff;
 		/* move last task to first to be fair.  */
-		tsched->schedTasks = _listMoveLasttoFirst(tsched->schedTasks);
-		goto selectCode(tsched);
+		manager->schedTasks = _listMoveLasttoFirst(manager->schedTasks);
+		goto selectCode(manager);
 	}
 }
 
@@ -185,4 +204,13 @@
 }
 
 
+void
+taskSpawn(UserManager *user, Task *task)
+{
+	TaskManager *manager = user->manager;
+	manager->waitingList = _listAddFirst(manager->waitingList, task);
+	//ablayer->spawnedTasks = _listAddFirst(ablayer->spawnedTasks, task);
+	return ;
+}
 
+
--- a/src/Fifo/TaskManager.h	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/Fifo/TaskManager.h	Fri Jan 08 20:00:01 2010 +0900
@@ -18,6 +18,8 @@
 	List *schedTasks;	// list of schedtasks executing now.
 	List *exitTasks;	// list of schedtasks which finished.
 	SchedTask *running;
+
+	struct _UserManager *user;
 } TaskManager;
 
 #endif /* !_TASKMANAGER_H */
--- a/src/Makefile.am	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/Makefile.am	Fri Jan 08 20:00:01 2010 +0900
@@ -6,7 +6,7 @@
 	$(CbCCOMPILE) -c -o $@ $<
 
 lib_LIBRARIES = libTaskManager.a
-libTaskManager_a_SOURCES = TaskManagerAbst.cbc List.c
+libTaskManager_a_SOURCES = TaskManagerAbst.cbc List.c Debug.h
 
 if USE_FIFO
     libTaskManager_a_SOURCES += Fifo/TaskManager.cbc
@@ -18,3 +18,5 @@
 endif
 endif
 
+include_HEADERS = userinclude/CbCTaskManager.h
+
--- a/src/Makefile.in	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/Makefile.in	Fri Jan 08 20:00:01 2010 +0900
@@ -14,6 +14,7 @@
 
 @SET_MAKE@
 
+
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -33,7 +34,8 @@
 @USE_FIFO_TRUE@am__append_1 = Fifo/TaskManager.cbc
 @USE_FIFO_FALSE@@USE_PTHREAD_TRUE@am__append_2 = pthread/TaskManager.cbc
 subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
@@ -47,14 +49,14 @@
     *) f=$$p;; \
   esac;
 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(libdir)"
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
 libLIBRARIES_INSTALL = $(INSTALL_DATA)
 LIBRARIES = $(lib_LIBRARIES)
 AR = ar
 ARFLAGS = cru
 libTaskManager_a_AR = $(AR) $(ARFLAGS)
 libTaskManager_a_LIBADD =
-am__libTaskManager_a_SOURCES_DIST = TaskManagerAbst.cbc List.c \
+am__libTaskManager_a_SOURCES_DIST = TaskManagerAbst.cbc List.c Debug.h \
 	Fifo/TaskManager.cbc pthread/TaskManager.cbc
 am__dirstamp = $(am__leading_dot)dirstamp
 @USE_FIFO_TRUE@am__objects_1 = Fifo/TaskManager.$(OBJEXT)
@@ -71,6 +73,8 @@
 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libTaskManager_a_SOURCES)
 DIST_SOURCES = $(am__libTaskManager_a_SOURCES_DIST)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -169,10 +173,11 @@
 	     $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 
 lib_LIBRARIES = libTaskManager.a
-libTaskManager_a_SOURCES = TaskManagerAbst.cbc List.c $(am__append_1) \
-	$(am__append_2)
+libTaskManager_a_SOURCES = TaskManagerAbst.cbc List.c Debug.h \
+	$(am__append_1) $(am__append_2)
 @USE_FIFO_FALSE@@USE_PTHREAD_TRUE@AM_CPPFLAGS = -I$(srcdir)/pthread
 @USE_FIFO_TRUE@AM_CPPFLAGS = -I$(srcdir)/Fifo
+include_HEADERS = userinclude/CbCTaskManager.h
 all: all-am
 
 .SUFFIXES:
@@ -186,9 +191,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  src/Makefile
+	  $(AUTOMAKE) --gnu  src/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -279,6 +284,23 @@
 @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) '$<'`
+install-includeHEADERS: $(include_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  f=$(am__strip_dir) \
+	  echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+	  $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+	done
+
+uninstall-includeHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(include_HEADERS)'; for p in $$list; do \
+	  f=$(am__strip_dir) \
+	  echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+	  rm -f "$(DESTDIR)$(includedir)/$$f"; \
+	done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -355,9 +377,9 @@
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(LIBRARIES)
+all-am: Makefile $(LIBRARIES) $(HEADERS)
 installdirs:
-	for dir in "$(DESTDIR)$(libdir)"; do \
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 	done
 install: install-am
@@ -408,7 +430,7 @@
 
 info-am:
 
-install-data-am:
+install-data-am: install-includeHEADERS
 
 install-dvi: install-dvi-am
 
@@ -443,7 +465,7 @@
 
 ps-am:
 
-uninstall-am: uninstall-libLIBRARIES
+uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES
 
 .MAKE: install-am install-strip
 
@@ -452,13 +474,14 @@
 	distclean-generic distclean-tags distdir dvi dvi-am html \
 	html-am info info-am install install-am install-data \
 	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-libLIBRARIES install-man install-pdf \
-	install-pdf-am install-ps install-ps-am install-strip \
-	installcheck installcheck-am installdirs maintainer-clean \
+	install-exec-am install-html install-html-am \
+	install-includeHEADERS install-info install-info-am \
+	install-libLIBRARIES 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 pdf pdf-am ps ps-am tags uninstall \
-	uninstall-am uninstall-libLIBRARIES
+	uninstall-am uninstall-includeHEADERS uninstall-libLIBRARIES
 
 
 .cbc.o:
--- a/src/TaskManagerAbst.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/TaskManagerAbst.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -59,7 +59,7 @@
 	Task *task;
 	task = createTask(i, "start task");
 	taskSetData(task, NULL, 0, NULL, 0);
-	taskSpawn(manager, task);
+	manager->waitingList = _listAddFirst(manager->waitingList, task);
 
 	goto checkEvent(manager);
 }
@@ -203,11 +203,3 @@
 	task_b->waiter = _listAddFirst(task_b->waiter, task_a);
 }
 
-void
-taskSpawn(TaskManager *manager, Task *task)
-{
-	manager->waitingList = _listAddFirst(manager->waitingList, task);
-	//ablayer->spawnedTasks = _listAddFirst(ablayer->spawnedTasks, task);
-	return ;
-}
-
--- a/src/pthread/TaskManager.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/pthread/TaskManager.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -2,6 +2,14 @@
 #include "Task.h"
 #include "Debug.h"
 
+
+typedef struct _UserManager {
+	Scheduler scheduler;
+	TaskManager *manager;
+} UserManager;
+// used only in this file.
+
+
 /* defined in TaskManagerAbst.  */
 extern Task *createTask(int, char *);
 extern void taskSetData(Task*, void*, int, void*, int);
@@ -16,8 +24,8 @@
 __code executeTask (TaskManager *manager, ListIter *iter, Task *task);
 __code checkEvent (TaskManager *manager);
 __code checkEvent_real (TaskManager *manager);
-__code selectCode (TaskManager *tsched);
-__code schedEntry (TaskManager *tsched, Taskrun nextcode, void *rbuff, void *wbuff);
+__code selectCode (TaskManager *manager);
+__code schedEntry (TaskManager *manager, Taskrun nextcode, void *rbuff, void *wbuff);
 
 /* external code segments.  */
 extern __code executed (TaskManager *manager, ListIter *iter, Task *task);
@@ -51,10 +59,14 @@
 {
 	TaskManager *manager;
 	manager = malloc(sizeof(TaskManager));
+	umanager= malloc(sizeof(UserManager));
 	manager->waitingList = NULL;
 	manager->activeList = NULL;
 	manager->finishtaskQ = createQueue();
-	scheduler = schedEntry;
+	manager->user = umanager;
+
+	umanager->manager = manager;
+	umanager->scheduler = schedEntry;
 	goto startThreadManager(manager);
 }
 
@@ -117,9 +129,8 @@
 	SchedTask *stask;
 	Task *task;
 	//printTasks(manager);
-	if (manager->exitTasks) {
-		stask = _listGetnthData(manager->exitTasks, 0);
-		manager->exitTasks = _listRemove(manager->exitTasks, stask);
+	stask = Qpoll(manager->finishtaskQ);
+	if (stask) {
 		task = stask->task;
 		free(stask);
 		__DEBUG("task[%d] finished.\n", task->id);
@@ -141,42 +152,42 @@
 /*
  *  Scheduler
  */
-__code
-selectCode(TaskManager *tsched)
+static __code
+selectCode(TaskManager *manager)
 {
 	SchedTask *task;
-	if (tsched->schedTasks) {
-		task = (SchedTask*)_listGetLastData(tsched->schedTasks);
-		tsched->running = task;
+	if (manager->schedTasks) {
+		task = (SchedTask*)_listGetLastData(manager->schedTasks);
+		manager->running = task;
 
 		/* goto user-defined task.  */
-		goto task->nextcode(tsched, task->task->rbuff, task->task->wbuff);
+		goto task->nextcode(manager->user, task->task->rbuff, task->task->wbuff);
 	} else {
 		/* no task we have.  */
 		//goto checkNewCode();
-		goto checkEvent_real(tsched);
+		goto checkEvent_real(manager);
 	}
 }
 
-__code
-schedEntry(TaskManager *tsched, Taskrun nextcode, void *rbuff, void *wbuff)
+static __code
+schedEntry(UserManager *user, Taskrun nextcode, void *rbuff, void *wbuff)
 {
+	TaskManager *manager = user->manager;
 	/* schedulerd  */
 	if ( nextcode==NULL ) {
 		/* the task finished.  */
-		tsched->schedTasks =
-			_listRemove(tsched->schedTasks, tsched->running);
-		tsched->exitTasks =
-			_listAddFirst(tsched->exitTasks, tsched->running);
-		goto selectCode(tsched);
+		manager->schedTasks =
+			_listRemove(manager->schedTasks, manager->running);
+		Qoffer(manager->finishtaskQ, manager->running);
+		goto selectCode(manager->manager);
 	} else {
 		/* save the next code segment for the task.  */
-		tsched->running->nextcode = nextcode;
-		tsched->running->rbuff = rbuff;
-		tsched->running->wbuff = wbuff;
+		manager->running->nextcode = nextcode;
+		manager->running->rbuff = rbuff;
+		manager->running->wbuff = wbuff;
 		/* move last task to first to be fair.  */
-		tsched->schedTasks = _listMoveLasttoFirst(tsched->schedTasks);
-		goto selectCode(tsched);
+		manager->schedTasks = _listMoveLasttoFirst(manager->schedTasks);
+		goto selectCode(manager);
 	}
 }
 
--- a/src/pthread/TaskManager.h	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/pthread/TaskManager.h	Fri Jan 08 20:00:01 2010 +0900
@@ -24,6 +24,13 @@
 
 	Queue finishtaskQ;  // Task Queue which shared by TaskManager
 	                  	// and all ThreadManagers.
+
+	struct _UserManager *user;	// used by user.
 } TaskManager;
 
+typedef struct _UserManager {
+	Scheduler scheduler;
+	TaskManager *manager;
+} UserManager;
+
 #endif /* !_TASKMANAGER_H */
--- a/src/pthread/ThreadManager.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/pthread/ThreadManager.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -4,27 +4,32 @@
 
 #include "Debug.h"
 #include "Fifo/SchedTask.h"
+#include "ThreadManager.h"
 
 
-typedef struct _ThreadManager {
-	pthread_t thread;
-	int thread_id;
-	int finishFlag;
-
-	// These Queue should be changed to Blocking-Queue.
-	// Now, when the thread has no task, he wait by busy loop.
-	Queue newtaskQ;
-	Queue finishtaskQ;
-
-	List schedTasks;
-	SchedTask running;
-} ThreadManager;
+typedef struct _UserManager {
+	Scheduler scheduler;
+	struct _ThreadManager *threadmanager;
+	/*
+	 * ユーザ側からは次のように見えるのが望ましい?
+	 *  struct UserManager {
+	 *  	Scheduler scheduler;
+	 *  }
+	 */
+} UserManager;
 
 
 void *
 threadbase(void *args)
 {
 	ThreadManager *manager = args;
+	UserManager *umanager;
+
+	umanager = malloc(sizeof(Usermanager));
+	umanager->scheduler = schedEntry;
+	umanager->threadmanager = manager;
+	manager->user = umanager;
+
 	goto threadloop(manager);
 }
 
@@ -42,6 +47,7 @@
 exitThread(ThreadManager *manager)
 {
 	__DEBUG("thread whose id is %d finished!", manager->thread_id);
+	free(manager->user);
 	pthread_exit(0);
 }
 
@@ -70,7 +76,7 @@
  *  copied from Fifo/TaskManager.cbc.
  *  it may should be organized to common codes.
  */
-__code
+static __code
 selectCode(ThreadManager *manager)
 {
 	SchedTask *task;
@@ -79,7 +85,7 @@
 		manager->running = task;
 
 		/* goto user-defined task.  */
-		goto task->nextcode(manager, task->task->rbuff, task->task->wbuff);
+		goto task->nextcode(manager->user, task->task->rbuff, task->task->wbuff);
 	} else {
 		/* no task we have.  */
 		//goto checkNewCode();
@@ -87,9 +93,10 @@
 	}
 }
 
-__code
-schedEntry(ThreadManager *manager, Taskrun nextcode, void *rbuff, void *wbuff)
+static __code
+schedEntry(UserManager *user, Taskrun nextcode, void *rbuff, void *wbuff)
 {
+	ThreadManager *manager = user->threadmanager;
 	/* schedulerd  */
 	if ( nextcode==NULL ) {
 		/* the task finished.  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pthread/ThreadManager.h	Fri Jan 08 20:00:01 2010 +0900
@@ -0,0 +1,23 @@
+#ifndef _THREADMANAGER_H
+#define _THREADMANAGER_H
+#include <pthread.h>
+#include <List.h>
+#include <Queue.h>
+
+typedef struct _ThreadManager {
+	pthread_t thread;
+	int thread_id;
+	int finishFlag;
+
+	// These Queue should be changed to Blocking-Queue.
+	// Now, when the thread has no task, he wait by busy loop.
+	Queue newtaskQ;
+	Queue finishtaskQ;
+
+	List schedTasks;
+	SchedTask running;
+
+	struct _UserManager *user;
+} ThreadManager;
+
+#endif /* _THREADMANAGER_H */
--- a/src/taskinit.cbc	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/taskinit.cbc	Fri Jan 08 20:00:01 2010 +0900
@@ -1,9 +1,20 @@
-#include "Task.h"
+#include "CbCTaskManager.h"
 #include "taskinit.h"
 
+#define F_NONE 0x000
+#define F_STARTER 0x001
+#define F_a 0x002
+#define F_b 0x004
+
+typedef struct _TaskType {
+	Taskrun code;
+	char *name;
+	unsigned int flag; // F_STARTER ..
+} TaskType;
+
 
 const int max_tasktype = MAX_TASKCLASS;
-extern __code nojob(void *, void *, void *);
+extern __code nojob(UserManager *, void *, void *);
 
 #undef DEFINETASKTYPE
 #define DEFINETASKTYPE(_var, _code0, _name, _type) \
--- a/src/taskinit.h	Fri Jan 08 14:51:19 2010 +0900
+++ b/src/taskinit.h	Fri Jan 08 20:00:01 2010 +0900
@@ -5,10 +5,12 @@
 /* ユーザはtasks.defを定義する  */
 /* DEFINETASK(TASK, code, "task name", CPU_TYPE) */
 
+#include <CbCTaskManager.h>
+
 /* define code segment of tasks.  */
 #undef DEFINETASKTYPE
 #define DEFINETASKTYPE(_var, _code0, _name, _type) \
-	extern __code _code0(void*,void*,void*);
+	extern __code _code0(UserManager*,void*,void*);
 
 #include "task.def"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/userinclude/CbCTaskManager.h	Fri Jan 08 20:00:01 2010 +0900
@@ -0,0 +1,25 @@
+#ifndef _USER_H
+#define _USER_H
+// included by user.
+
+struct _UserManager;
+
+typedef __code (*Taskrun)(struct _UserManager*, void*, void*);
+typedef __code (*Scheduler)(struct _UserManager*,Taskrun,void*,void*);
+
+struct _UserManager {
+	Scheduler scheduler;
+};
+typedef struct _UserManager UserManager;
+typedef void UserTask;
+
+#define ENDTASK ((Taskrun)NULL)
+
+extern UserTask *createTask(int id, char *);
+extern void taskSetData(UserTask*,void*,int,void*,int);
+extern void taskSetWait(UserTask*, UserTask*);
+extern void taskSpawn(UserManager*, UserTask*);
+
+
+#endif /* _USER_H */
+