use a DWORD, not a HANDLE Vincent
On Tue, 9 Aug 2011, Enlightenment SVN wrote: > Log: > eina: detect main loop for windows to. > > > Author: cedric > Date: 2011-08-09 01:47:57 -0700 (Tue, 09 Aug 2011) > New Revision: 62239 > Trac: http://trac.enlightenment.org/e/changeset/62239 > > Modified: > trunk/eina/src/lib/eina_main.c > > Modified: trunk/eina/src/lib/eina_main.c > =================================================================== > --- trunk/eina/src/lib/eina_main.c 2011-08-09 08:46:29 UTC (rev 62238) > +++ trunk/eina/src/lib/eina_main.c 2011-08-09 08:47:57 UTC (rev 62239) > @@ -28,6 +28,13 @@ > # undef WIN32_LEAN_AND_MEAN > #endif > > +#ifdef EFL_HAVE_THREADS > +# if !(defined(_WIN32_WCE)) && !(defined(_WIN32)) > +# include <sys/types.h> > +# include <unistd.h> > +# endif > +#endif > + > #include "eina_lock.h" > #include "eina_config.h" > #include "eina_private.h" > @@ -76,13 +83,14 @@ > > EAPI Eina_Bool _eina_threads_activated = EINA_FALSE; > > -#ifdef EINA_HAVE_THREADS > +#ifdef EFL_HAVE_THREADS > # ifdef _WIN32_WCE > -# warning "no way to know the main loop thread id yet on Windows CE !" > +EAPI HANDLE _eina_main_loop; > # elif defined(_WIN32) > -# warning "no way to know the main loop thread id yet on Windows !" > +EAPI HANDLE _eina_main_loop; > # else > -EAPI pthread_t _eina_main_loop;; > +EAPI pthread_t _eina_main_loop; > +static pid_t _eina_pid; > # endif > #endif > > @@ -214,9 +222,14 @@ > return 0; > } > > -#ifdef EINA_HAVE_THREADS > -# if !(defined(_WIN32_WCE)) && !(defined(_WIN32)) > +#ifdef EFL_HAVE_THREADS > +# ifdef _WIN32_CE > + _eina_main_loop = (HANDLE) GetCurrentThreadId(); > +# elif defined (_WIN32) > + _eina_main_loop = (HANDLE) GetCurrentThreadId(); > +# else > _eina_main_loop = pthread_self(); > + _eina_pid = getpid(); > # endif > #endif > > @@ -333,13 +346,27 @@ > EAPI Eina_Bool > eina_main_loop_is(void) > { > -#ifdef EINA_HAVE_THREADS > +#ifdef EFL_HAVE_THREADS > /* FIXME: need to check how to do this on windows */ > # ifdef _WIN32_CE > + if (_eina_main_loop == (HANDLE) GetCurrentThreadId()) > + return EINA_TRUE; > return EINA_FALSE; > # elif defined(_WIN32) > + if (_eina_main_loop == (HANDLE) GetCurrentThreadId()) > + return EINA_TRUE; > return EINA_FALSE; > # else > + pid_t pid = getpid(); > + > + if (pid != _eina_pid) > + { > + /* This is in case of a fork, but don't like the solution */ > + _eina_pid = pid; > + _eina_main_loop = pthread_self(); > + return EINA_TRUE; > + } > + > if (pthread_equal(_eina_main_loop, pthread_self())) > return EINA_TRUE; > # endif > > > ------------------------------------------------------------------------------ > uberSVN's rich system and user administration capabilities and model > configuration take the hassle out of deploying and managing Subversion and > the tools developers use with it. Learn more about uberSVN and get a free > download at: http://p.sf.net/sfu/wandisco-dev2dev > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > ------------------------------------------------------------------------------ uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel