Whoua, thank you a lot !!!!! 2011/2/26 Enlightenment SVN <no-re...@enlightenment.org>
> Log: > Enlil: > > * make it work on Windows > * clean up autotools > > > Author: caro > Date: 2011-02-26 13:34:04 -0800 (Sat, 26 Feb 2011) > New Revision: 57343 > Trac: http://trac.enlightenment.org/e/changeset/57343 > > Added: > trunk/enlil/m4/efl_compiler_flag.m4 trunk/enlil/m4/efl_threads.m4 > Removed: > trunk/enlil/m4/efl_pthread.m4 > Modified: > trunk/enlil/AUTHORS trunk/enlil/configure.ac > trunk/enlil/enlil.pc.intrunk/enlil/src/bin_geocaching_print/Makefile.am > trunk/enlil/src/bin_load_sync/Makefile.am > trunk/enlil/src/bin_print/Makefile.am trunk/enlil/src/bin_sync/Makefile.am > trunk/enlil/src/bin_transformations/Makefile.am > trunk/enlil/src/enlil/Enlil.h trunk/enlil/src/enlil/Makefile.am > trunk/enlil/src/enlil/enlil_private.h trunk/enlil/src/enlil/file_manager.c > trunk/enlil/src/enlil/load.c trunk/enlil/src/enlil/sync.c > > Modified: trunk/enlil/AUTHORS > =================================================================== > --- trunk/enlil/AUTHORS 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/AUTHORS 2011-02-26 21:34:04 UTC (rev 57343) > @@ -1 +1,2 @@ > Atton Jonathan alias Watchwolf (jonathan.at...@gmail.com) > +Vincent Torri <vtorri at univ-evry dot fr> > > Modified: trunk/enlil/configure.ac > =================================================================== > --- trunk/enlil/configure.ac 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/configure.ac 2011-02-26 21:34:04 UTC (rev 57343) > @@ -1,94 +1,118 @@ > # get rid of that stupid cache mechanism > rm -f config.cache > > -AC_INIT(configure.ac) > +m4_define([v_maj], [0]) > +m4_define([v_min], [6]) > +m4_define([v_mic], [0]) > +m4_define([v_ver], [v_maj.v_min.v_mic]) > + > +m4_define([lt_rev], m4_eval(v_maj + v_min)) > +m4_define([lt_cur], v_mic) > +m4_define([lt_age], v_min) > + > +AC_INIT([enlil], [v_ver]) > +AC_PREREQ([2.52]) > +AC_CONFIG_SRCDIR([configure.ac]) > +AC_CONFIG_MACRO_DIR([m4]) > +AC_CONFIG_HEADERS([config.h]) > + > AC_CANONICAL_TARGET > AC_CANONICAL_BUILD > AC_CANONICAL_HOST > > -AM_INIT_AUTOMAKE(Enlil, 0.6) > -AM_CONFIG_HEADER(config.h) > +AM_INIT_AUTOMAKE([1.6 dist-bzip2]) > m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) > > -AC_PROG_CC > -AM_PROG_CC_STDC > -AC_HEADER_STDC > -AC_C_CONST > -AM_PROG_CC_C_O > - > +AC_LIBTOOL_WIN32_DLL > +define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl > +define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl > AM_PROG_LIBTOOL > - > +version_info="lt_rev:lt_cur:lt_age" > AC_SUBST(version_info) > -AC_SUBST(requirements) > -AC_SUBST(packagesrcdir) > -AC_SUBST(packagedatadir) > > + > +### Needed information > + > +AC_CANONICAL_BUILD > +AC_CANONICAL_HOST > + > +### Default options with respect to host > + > + > +### Additional options to configure > + > + > +### Checks for programs > +AC_PROG_CC > + > +# pkg-config > PKG_PROG_PKG_CONFIG > > -define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl > -define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl > -# Find edje_cc > -PKG_CHECK_MODULES(EDJE, [edje >= 0.5.0]) > -AC_ARG_WITH(edje-cc, > - AC_HELP_STRING([--with-edje-cc=PATH], [specify a specific path to > edje_cc]), > - [ > - v=$withval; > - EDJE_CC=$v > - ],[ > - EDJE_CC=$(pkg-config --variable=prefix edje)/bin/edje_cc > - ] > -) > +# Check whether pkg-config supports Requires.private > +if $PKG_CONFIG --atleast-pkgconfig-version 0.22; then > + pkgconfig_requires_private="Requires.private" > +else > + pkgconfig_requires_private="Requires" > +fi > +AC_SUBST(pkgconfig_requires_private) > > # doxygen program for documentation building > + > EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) > > -EFL_CHECK_PTHREAD(["yes"], > - [have_pthread="yes"], > - [have_pthread="no"], > - [have_pthread_spinlock="yes"], > - [have_pthread_spinlock="no"]) > > +### Checks for libraries > > -requirement_flickr="" > -have_flickr="no" > +requirements="ethumb_client >= 0.1.0 ecore-file >= 1.0.0 ecore >= 1.0.0 > evas >= 1.0.0 eet >= 1.2.2 eina >= 1.0.0 libexif >= 0.6.16 libiptcdata >= > 1.0.2" > > -PKG_CHECK_MODULES(EABZU, [eabzu_client > 0.0.1 ], > - requirement_eabzu="eabzu_client" > - have_eabzu="yes" > - AC_DEFINE_UNQUOTED(HAVE_EABZU, "${have_eabzu}", [have > network synchronization (eabzu) support]), > - have_eabzu="no" > - ) > -# required libs / cflags > -flickr_libs=$FLICKR_LIBS > -flickr_cflags=$FLICKR_CFLAGS > -AC_SUBST(flickr_libs) > -AC_SUBST(flickr_cflags) > +PKG_CHECK_EXISTS([eabzu_client >= 0.0.1], > + [ > + requirements="eabzu_client >= 0.0.1 ${requirements}" > + have_eabzu="yes" > + AC_DEFINE_UNQUOTED(HAVE_EABZU, [1]", [have network synchronization > (eabzu) support]) > + ], > + [have_eabzu="no"]) > > -requirements="ecore eet ecore-file evas ethumb_client" > -requirements="${requirements} ${requirement_flickr}" > -AC_SUBST(requirements) > +PKG_CHECK_MODULES([ENLIL], [${requirements}]) > > +EFL_CHECK_THREADS( > + [ > + if test "x${_efl_have_posix_threads}" = "xyes" ; then > + have_threads="POSIX" > + else > + if test "x${_efl_have_win32_threads}" = "xyes" ; then > + have_threads="Win32" > + else > + have_threads="no" > + fi > + fi], > + [have_threads="no"]) > > +if test "x${have_threads}" = "xno" ; then > + AC_MSG_ERROR([Thread support must be enabled]) > +fi > > -PKG_CHECK_MODULES(ENLIL, [ > - ecore >= 0.9.9.062 > - ecore-file >= 0.9.9.062 > - eet >= 1.2.2 > - ethumb_client >= 0.1 > - libexif >= 0.6.16 > - libiptcdata >= 1.0.2 > - libxml-2.0 >= 0.1.1 > - ]) > -# required libs / cflags > -enlil_libs=$ENLIL_LIBS > -enlil_cflags=$ENLIL_CFLAGS > -AC_SUBST(enlil_libs) > -AC_SUBST(enlil_cflags) > > -AC_SUBST(EDJE_CC) > -AC_MSG_CHECKING([Which edje_cc to use]) > -AC_MSG_RESULT(${EDJE_CC}) > +### Checks for compiler characteristics > +AM_PROG_CC_STDC > +AC_HEADER_STDC > +AC_C_CONST > +AM_PROG_CC_C_O > > +EFL_COMPILER_FLAG([-Wall]) > +EFL_COMPILER_FLAG([-W]) > +EFL_COMPILER_FLAG([-Wshadow]) > + > +EFL_ENLIL_BUILD="" > +case "$host_os" in > + mingw*) > + EFL_ENLIL_BUILD="-DEFL_ENLIL_BUILD" > + ;; > +esac > +AC_SUBST(EFL_ENLIL_BUILD) > + > +AC_SUBST(requirements) > + > AC_OUTPUT([ > Makefile > src/Makefile > @@ -110,11 +134,12 @@ > echo "--------------------------------------------------------" > echo > echo > -echo " Installation Path...................: $prefix" > -echo "" > -echo " Thread Support...........................: ${have_pthread} > (spinlock: ${have_pthread_spinlock})" > -echo " Network synchronisation support (requires eabzu_client) .....: > ${have_eabzu}" > +echo " Network synchronisation..: ${have_eabzu}" > +echo " Thread Support...........: ${have_threads}" > echo > +echo "Installation...............: make install (as root if needed, with > 'su' or 'sudo')" > +echo " prefix...................: $prefix" > +echo > echo "Now type 'make' ('gmake' on some systems) to compile $PACKAGE," > echo "and then afterwards as root (or the user who will install this), > type" > echo "'make install'. Change users with 'su' or 'sudo' appropriately." > > Modified: trunk/enlil/enlil.pc.in > =================================================================== > --- trunk/enlil/enlil.pc.in 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/enlil.pc.in 2011-02-26 21:34:04 UTC (rev 57343) > @@ -7,7 +7,7 @@ > > Name: Enlil > Description: no description atm. > -Requires: @requirements@ > +@pkgconfig_requires_private@: @requirements@ > Version: @VERSION@ > Libs: -L${libdir} -lenlil > Cflags: -I${includedir} -I${includedir}/enlil > > Modified: trunk/enlil/src/bin_geocaching_print/Makefile.am > =================================================================== > --- trunk/enlil/src/bin_geocaching_print/Makefile.am 2011-02-26 20:08:21 > UTC (rev 57342) > +++ trunk/enlil/src/bin_geocaching_print/Makefile.am 2011-02-26 21:34:04 > UTC (rev 57343) > @@ -1,12 +1,13 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -AM_CFLAGS = \ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ > --Wall -g -I$(top_srcdir)/src/enlil @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +@ENLIL_CFLAGS@ > > bin_PROGRAMS = enlil_geocaching_print > > enlil_geocaching_print_SOURCES = bin_print.c > -enlil_geocaching_print_LDADD = > $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@@EABZU_LIBS@ > - > +enlil_geocaching_print_LDADD = > $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@ > > Modified: trunk/enlil/src/bin_load_sync/Makefile.am > =================================================================== > --- trunk/enlil/src/bin_load_sync/Makefile.am 2011-02-26 20:08:21 UTC > (rev 57342) > +++ trunk/enlil/src/bin_load_sync/Makefile.am 2011-02-26 21:34:04 UTC > (rev 57343) > @@ -1,12 +1,13 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -AM_CFLAGS = \ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ > --Wall -g -I$(top_srcdir)/src/enlil @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +@ENLIL_CFLAGS@ > > bin_PROGRAMS = enlil_db_load_sync > > enlil_db_load_sync_SOURCES = bin_load_sync.c > -enlil_db_load_sync_LDADD = > $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@@EABZU_LIBS@ > - > +enlil_db_load_sync_LDADD = $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@ > > Modified: trunk/enlil/src/bin_print/Makefile.am > =================================================================== > --- trunk/enlil/src/bin_print/Makefile.am 2011-02-26 20:08:21 UTC > (rev 57342) > +++ trunk/enlil/src/bin_print/Makefile.am 2011-02-26 21:34:04 UTC > (rev 57343) > @@ -1,12 +1,13 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -AM_CFLAGS = \ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ > --Wall -g -I$(top_srcdir)/src/enlil @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +@ENLIL_CFLAGS@ > > bin_PROGRAMS = enlil_db_print > > enlil_db_print_SOURCES = bin_print.c > -enlil_db_print_LDADD = $(top_builddir)/src/enlil/libenlil.la > @ENLIL_LIBS@@EABZU_LIBS@ > - > +enlil_db_print_LDADD = $(top_builddir)/src/enlil/libenlil.la @ENLIL_LIBS@ > > Modified: trunk/enlil/src/bin_sync/Makefile.am > =================================================================== > --- trunk/enlil/src/bin_sync/Makefile.am 2011-02-26 20:08:21 UTC > (rev 57342) > +++ trunk/enlil/src/bin_sync/Makefile.am 2011-02-26 21:34:04 UTC > (rev 57343) > @@ -1,12 +1,13 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -AM_CFLAGS = \ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ > --Wall -g -I$(top_srcdir)/src/enlil @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +@ENLIL_CFLAGS@ > > bin_PROGRAMS = enlil_db_sync > > enlil_db_sync_SOURCES = bin_sync.c > -enlil_db_sync_LDADD = $(top_builddir)/src/enlil/libenlil.la > @ENLIL_LIBS@@EABZU_LIBS@ > - > +enlil_db_sync_LDADD = $(top_builddir)/src/enlil/libenlil.la @ENLIL_LIBS@ > > Modified: trunk/enlil/src/bin_transformations/Makefile.am > =================================================================== > --- trunk/enlil/src/bin_transformations/Makefile.am 2011-02-26 20:08:21 > UTC (rev 57342) > +++ trunk/enlil/src/bin_transformations/Makefile.am 2011-02-26 21:34:04 > UTC (rev 57343) > @@ -1,12 +1,13 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -AM_CFLAGS = \ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ > --Wall -g -I$(top_srcdir)/src/enlil @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +@ENLIL_CFLAGS@ > > bin_PROGRAMS = enlil_transformations > > enlil_transformations_SOURCES = main.c > -enlil_transformations_LDADD = > $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@@EABZU_LIBS@ > - > +enlil_transformations_LDADD = > $(top_builddir)/src/enlil/libenlil.la@ENLIL_LIBS@ > > Modified: trunk/enlil/src/enlil/Enlil.h > =================================================================== > --- trunk/enlil/src/enlil/Enlil.h 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/src/enlil/Enlil.h 2011-02-26 21:34:04 UTC (rev 57343) > @@ -1,38 +1,37 @@ > #ifndef ENLIL_INC > #define ENLIL_INC > > +#include <Eina.h> > +#include <Eet.h> > #include <Ecore.h> > #include <Ecore_File.h> > -#include <Eet.h> > -#include <string.h> > #include <Ethumb_Client.h> > > #ifdef EAPI > # undef EAPI > #endif > > -#ifndef EAPI > #ifdef _WIN32 > +# ifdef EFL_ENLIL_BUILD > # ifdef DLL_EXPORT > # define EAPI __declspec(dllexport) > # else > # define EAPI > # endif /* ! DLL_EXPORT */ > +# else > +# define EAPI __declspec(dllimport) > +# endif /* ! EFL_ENLIL_BUILD */ > #else > # ifdef __GNUC__ > # if __GNUC__ >= 4 > # define EAPI __attribute__ ((visibility("default"))) > -# define GNUC_NULL_TERMINATED __attribute__((__sentinel__)) > # else > # define EAPI > -# define GNUC_NULL_TERMINATED > # endif > # else > # define EAPI > -# define GNUC_NULL_TERMINATED > # endif > -#endif /* ! _WIN32 */ > -#endif /* EAPI */ > +#endif > > /** TODO > * Browse albums recursively > > Modified: trunk/enlil/src/enlil/Makefile.am > =================================================================== > --- trunk/enlil/src/enlil/Makefile.am 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/src/enlil/Makefile.am 2011-02-26 21:34:04 UTC (rev 57343) > @@ -1,11 +1,14 @@ > > MAINTAINERCLEANFILES = Makefile.in > > -INCLUDES = \ > - -Wall -g @ENLIL_CFLAGS@ @EABZU_CFLAGS@ > +AM_CPPFLAGS = \ > +-I$(top_srcdir)/src/enlil \ > +-I$(top_builddir)/src/enlil \ > +@ENLIL_CFLAGS@ \ > +@EFL_ENLIL_BUILD@ > > -lib_LTLIBRARIES = libenlil.la > -ENLILHEADERS = Enlil.h > +lib_LTLIBRARIES = libenlil.la > + > libenlil_la_SOURCES = \ > enlil.c \ > Enlil.h \ > @@ -31,11 +34,9 @@ > download.c > > installed_headersdir = $(prefix)/include/enlil > -installed_headers_DATA = $(ENLILHEADERS) > +installed_headers_DATA = Enlil.h > > -libenlil_la_LIBADD = @ENLIL_LIBS@ @EABZU_LIBS@ > +libenlil_la_LIBADD = @ENLIL_LIBS@ > > -libenlil_la_DEPENDENCIES = > +libenlil_la_LDFLAGS = -no-undefined -version-info @version_info@ > > -libenlil_la_LDFLAGS = -version-info 1:0:0 > - > > Modified: trunk/enlil/src/enlil/enlil_private.h > =================================================================== > --- trunk/enlil/src/enlil/enlil_private.h 2011-02-26 20:08:21 UTC > (rev 57342) > +++ trunk/enlil/src/enlil/enlil_private.h 2011-02-26 21:34:04 UTC > (rev 57343) > @@ -2,7 +2,11 @@ > #define ENLIL_PRIVATE_INC > > #include "Enlil.h" > -#include <pthread.h> > + > +#ifdef EFL_HAVE_POSIX_THREADS > +# include <pthread.h> > +#endif > + > #include <errno.h> > > #include "../define.h" > > Modified: trunk/enlil/src/enlil/file_manager.c > =================================================================== > --- trunk/enlil/src/enlil/file_manager.c 2011-02-26 20:08:21 UTC > (rev 57342) > +++ trunk/enlil/src/enlil/file_manager.c 2011-02-26 21:34:04 UTC > (rev 57343) > @@ -1,5 +1,20 @@ > #include "enlil_private.h" > > +/* FIXME: destroy the mutex */ > + > +#ifdef EFL_HAVE_POSIX_THREADS > +# define ENLIL_MUTEX pthread_mutex_t > +# define ENLIL_MUTEX_INIT(Mutex) pthread_mutex_init(&(Mutex), NULL) > +# define ENLIL_MUTEX_LOCK(Mutex) pthread_mutex_lock(&(Mutex)) > +# define ENLIL_MUTEX_UNLOCK(Mutex) pthread_mutex_unlock(&(Mutex)) > +#else > +# include <windows.h> > +# define ENLIL_MUTEX HANDLE > +# define ENLIL_MUTEX_INIT(Mutex) Mutex = CreateMutex(NULL, FALSE, NULL) > +# define ENLIL_MUTEX_LOCK(Mutex) WaitForSingleObject(Mutex, INFINITE) > +# define ENLIL_MUTEX_UNLOCK(Mutex) ReleaseMutex(Mutex) > +#endif > + > //LRU list of Eet_File * > #define MAX_SIZE_LIST 3 > > @@ -11,7 +26,7 @@ > static Eet_Data_Descriptor * _edd_version_new(); > > static Eina_List *file_list = NULL; > -static pthread_mutex_t mutex; > +static ENLIL_MUTEX mutex; > > static EET_File_Version current_version; > static Eet_Data_Descriptor *edd_version = NULL; > @@ -37,7 +52,7 @@ > current_version.version = EET_FILE_VERSION; > edd_version = _edd_version_new(); > > - pthread_mutex_init(&mutex, NULL); > + ENLIL_MUTEX_INIT(mutex); > > return ++count; > } > @@ -49,12 +64,12 @@ > > enlil_file_manager_flush(); > > - pthread_mutex_lock(&mutex); > + ENLIL_MUTEX_LOCK(mutex); > EINA_LIST_FREE(file_list, data) > { > _data_free(data); > } > - pthread_mutex_unlock(&mutex); > + ENLIL_MUTEX_UNLOCK(mutex); > eet_data_descriptor_free(edd_version); > edd_version = NULL; > > @@ -91,7 +106,7 @@ > Eet_File *enlil_file_manager_open(const char *file) > { > //LOG_DBG("Open file %s", file); > - pthread_mutex_lock(&mutex); > + ENLIL_MUTEX_LOCK(mutex); > file = eina_stringshare_add(file); > File_Table_Data *f_data = _enlil_file_manager_find(file); > EET_File_Version *f_version; > @@ -144,14 +159,14 @@ > void enlil_file_manager_close(const char *file) > { > //LOG_DBG("Close file %s", file); > - pthread_mutex_unlock(&mutex); > + ENLIL_MUTEX_UNLOCK(mutex); > } > > void enlil_file_manager_flush() > { > Eina_List *l; > File_Table_Data *data; > - pthread_mutex_lock(&mutex); > + ENLIL_MUTEX_LOCK(mutex); > > EINA_LIST_FOREACH(file_list, l, data) > { > @@ -160,7 +175,7 @@ > data->f = NULL; > } > > - pthread_mutex_unlock(&mutex); > + ENLIL_MUTEX_UNLOCK(mutex); > } > > static void _data_free(File_Table_Data *data) > > Modified: trunk/enlil/src/enlil/load.c > =================================================================== > --- trunk/enlil/src/enlil/load.c 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/src/enlil/load.c 2011-02-26 21:34:04 UTC (rev 57343) > @@ -3,7 +3,21 @@ > #include <unistd.h> > #include <time.h> > > +/* FIXME: destroy the mutex */ > > +#ifdef EFL_HAVE_POSIX_THREADS > +# define ENLIL_MUTEX pthread_mutex_t > +# define ENLIL_MUTEX_INIT(Load) pthread_mutex_init(&(Load->mutex), NULL) > +# define ENLIL_MUTEX_LOCK(Load) pthread_mutex_lock(&(Load->mutex)) > +# define ENLIL_MUTEX_UNLOCK(Load) pthread_mutex_unlock(&(Load->mutex)) > +#else > +# include <windows.h> > +# define ENLIL_MUTEX HANDLE > +# define ENLIL_MUTEX_INIT(Load) Load->mutex = CreateMutex(NULL, FALSE, > NULL) > +# define ENLIL_MUTEX_LOCK(Load) WaitForSingleObject(Load->mutex, INFINITE) > +# define ENLIL_MUTEX_UNLOCK(Load) ReleaseMutex(Load->mutex) > +#endif > + > static void _enlil_load(void *data, Ecore_Thread *thread); > static void _album_load(Enlil_Load *load, Enlil_Album *album); > > @@ -34,7 +48,7 @@ > int is_running; > > // mutex use to pause the thread and wake up > - pthread_mutex_t mutex; > + ENLIL_MUTEX mutex; > > struct { > //thread send to the main loop > @@ -81,8 +95,8 @@ > load->conf.error_cb = error_cb; > load->conf.data = user_data; > > - pthread_mutex_init(&(load->mutex), NULL); > - pthread_mutex_lock(&(load->mutex)); > + ENLIL_MUTEX_INIT(load); > + ENLIL_MUTEX_LOCK(load); > > load->pipe.thread_main = ecore_pipe_add(_enlil_load_message_cb, load); > ASSERT_CUSTOM_RET(load->pipe.thread_main != NULL, > enlil_load_free(&load); return NULL;); > @@ -151,7 +165,7 @@ > load->msg.type = Enlil_LOAD_ALBUM_DONE; > load->msg.album = album; > ecore_pipe_write(load->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(load->mutex)); > + ENLIL_MUTEX_LOCK(load); > } > > static void _enlil_load(void *data, Ecore_Thread *thread) > @@ -204,7 +218,7 @@ > msg = eina_stringshare_add(load->msg.msg); > Enlil_Album *album = load->msg.album; > > - pthread_mutex_unlock(&(load->mutex)); > + ENLIL_MUTEX_UNLOCK(load); > > switch(load->msg.type) > { > > Modified: trunk/enlil/src/enlil/sync.c > =================================================================== > --- trunk/enlil/src/enlil/sync.c 2011-02-26 20:08:21 UTC (rev 57342) > +++ trunk/enlil/src/enlil/sync.c 2011-02-26 21:34:04 UTC (rev 57343) > @@ -3,6 +3,21 @@ > #include <unistd.h> > #include <time.h> > > +/* FIXME: destroy the mutex */ > + > +#ifdef EFL_HAVE_POSIX_THREADS > +# define ENLIL_MUTEX pthread_mutex_t > +# define ENLIL_MUTEX_INIT(Sync) pthread_mutex_init(&(Sync->mutex), NULL) > +# define ENLIL_MUTEX_LOCK(Sync) pthread_mutex_lock(&(Sync->mutex)) > +# define ENLIL_MUTEX_UNLOCK(Sync) pthread_mutex_unlock(&(Sync->mutex)) > +#else > +# include <windows.h> > +# define ENLIL_MUTEX HANDLE > +# define ENLIL_MUTEX_INIT(Sync) Sync->mutex = CreateMutex(NULL, FALSE, > NULL) > +# define ENLIL_MUTEX_LOCK(Sync) WaitForSingleObject(Sync->mutex, INFINITE) > +# define ENLIL_MUTEX_UNLOCK(Sync) ReleaseMutex(Sync->mutex) > +#endif > + > int LOG_DOMAIN; > > typedef struct Enlil_Sync_Configuration Enlil_Sync_Configuration; > @@ -58,7 +73,7 @@ > int is_running; > > // mutex used to pause the thread and wake up > - pthread_mutex_t mutex; > + ENLIL_MUTEX mutex; > > struct { > //thread send to the main loop > @@ -173,8 +188,8 @@ > sync->sync.error_cb = error_cb; > sync->sync.data = user_data; > > - pthread_mutex_init(&(sync->mutex), NULL); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_INIT(sync); > + ENLIL_MUTEX_LOCK(sync); > > sync->pipe.thread_main = ecore_pipe_add(_enlil_sync_message_cb, sync); > ASSERT_CUSTOM_RET(sync->pipe.thread_main != NULL, > enlil_sync_free(&sync); return NULL;); > @@ -448,7 +463,7 @@ > sync->msg.error = Sync_Error_Eet_Save_Failed; \ > sync->msg.msg = buf; \ > ecore_pipe_write(sync->pipe.thread_main, "a", 1); \ > - pthread_mutex_lock(&(sync->mutex)); \ > + ENLIL_MUTEX_LOCK(sync); \ > } \ > }while(0) > > @@ -502,7 +517,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > //update the list of album > if(photo_list) > @@ -527,7 +542,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > } > else if(!file_exist && photo) > { > @@ -536,7 +551,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > Enlil_Photo *photo_list = enlil_album_photo_search_file_name(album, > file); > if(photo_list) > @@ -583,7 +598,7 @@ > sync->msg.error = Sync_Error_Eet_Save_Failed; \ > sync->msg.msg = buf; \ > ecore_pipe_write(sync->pipe.thread_main, "a", 1); \ > - pthread_mutex_lock(&(sync->mutex)); \ > + ENLIL_MUTEX_LOCK(sync); \ > } \ > }while(0); > > @@ -629,7 +644,7 @@ > sync->msg.library = library; > sync->msg.album = album; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > > //update the list of album > @@ -658,7 +673,7 @@ > sync->msg.library = library; > sync->msg.album = album; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > } > */ > else if(album_list && !folder_exist) > @@ -673,7 +688,7 @@ > sync->msg.library = library; > sync->msg.album = album_list; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > //update the list of album > enlil_library_album_remove(library_list, album_list); > @@ -716,7 +731,7 @@ > sync->msg.error = Sync_Error_Eet_Save_Failed; \ > sync->msg.msg = buf; \ > ecore_pipe_write(sync->pipe.thread_main, "a", 1); \ > - pthread_mutex_lock(&(sync->mutex)); \ > + ENLIL_MUTEX_LOCK(sync); \ > } \ > }while (0); > > @@ -752,7 +767,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > #undef SAVE > } > @@ -775,7 +790,7 @@ > sync->msg.error = Sync_Error_Eet_Save_Failed; \ > sync->msg.msg = buf; \ > ecore_pipe_write(sync->pipe.thread_main, "a", 1); \ > - pthread_mutex_lock(&(sync->mutex)); \ > + ENLIL_MUTEX_LOCK(sync); \ > } \ > }while (0); > > @@ -810,7 +825,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > } > } > > @@ -879,7 +894,7 @@ > sync->msg.album = album; > sync->msg.photo = photo; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > enlil_photo_free(&photo); > } > @@ -912,7 +927,7 @@ > sync->msg.error = Sync_Error_Eet_Save_Failed; \ > sync->msg.msg = buf; \ > ecore_pipe_write(sync->pipe.thread_main, "a", 1); \ > - pthread_mutex_lock(&(sync->mutex)); \ > + ENLIL_MUTEX_LOCK(sync); \ > } \ > } while(0); > > @@ -943,7 +958,7 @@ > sync->msg.library = library; > sync->msg.album = album; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > Enlil_Album *album_list = enlil_album_new(); > enlil_album_path_set(album_list, enlil_album_path_get(album)); > @@ -993,7 +1008,7 @@ > sync->msg.library = library; > sync->msg.album = album; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > } */ > > _enlil_sync_all_album_sync(sync, album); > @@ -1062,7 +1077,7 @@ > sync->msg.library = library; > sync->msg.album = album; > ecore_pipe_write(sync->pipe.thread_main, "a", 1); > - pthread_mutex_lock(&(sync->mutex)); > + ENLIL_MUTEX_LOCK(sync); > > enlil_library_album_remove(library_list, album); > enlil_library_eet_album_remove(library_list, > enlil_album_file_name_get(album)); > @@ -1143,7 +1158,7 @@ > break; > case Enlil_SYNC_DONE: ; > } > - pthread_mutex_unlock(&(sync->mutex)); > + ENLIL_MUTEX_UNLOCK(sync); > } > > /** > > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > -- Regards. ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel