diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 63df068613..a99f39155a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,16 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-01 20:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbsetup.h + * harbour/include/hbthread.h + * harbour/include/hbatomic.h + * harbour/source/vm/thread.c + * added support for MT mode in WinCE builds using raw MS-Windows API + instead of CRTL wrappers. It's possible that it may badly interact + with some CRTLs functions we are using in our code so I do not know + it will work. Please test. + 2009-08-01 19:49 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * config/global.cf * Changed HB_BUILD_SUBDIR to HB_BUILD_NAME. diff --git a/harbour/include/hbatomic.h b/harbour/include/hbatomic.h index ee1fe467bc..c343b64af0 100644 --- a/harbour/include/hbatomic.h +++ b/harbour/include/hbatomic.h @@ -178,7 +178,8 @@ HB_EXTERN_BEGIN # define HB_SPINLOCK_ACQUIRE(l) hb_spinlock_acquire(l) # define HB_SPINLOCK_RELEASE(l) hb_spinlock_release(l) -# elif ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 1) ) +# elif ( ( __GNUC__ > 4 ) || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 1) ) && \ + !defined( __MINGW32CE__ ) # define HB_ATOM_INC( p ) __sync_add_and_fetch( (p), 1 ) # define HB_ATOM_DEC( p ) __sync_sub_and_fetch( (p), 1 ) diff --git a/harbour/include/hbsetup.h b/harbour/include/hbsetup.h index 59065fea9d..cff5faedfa 100644 --- a/harbour/include/hbsetup.h +++ b/harbour/include/hbsetup.h @@ -472,10 +472,6 @@ #define HB_OS_EOL_LEN 2 #endif -#if defined( HB_OS_WIN_CE ) && defined( HB_MT_VM ) - #undef HB_MT_VM -#endif - /* *********************************************************************** * See also the following files for task specific definitions/settings * diff --git a/harbour/include/hbthread.h b/harbour/include/hbthread.h index c09d9ff6d8..7cbae39bc8 100644 --- a/harbour/include/hbthread.h +++ b/harbour/include/hbthread.h @@ -173,14 +173,25 @@ HB_EXTERN_BEGIN #elif defined( HB_OS_WIN ) typedef HB_LONG HB_THREAD_NO; - typedef unsigned HB_THREAD_ID; typedef HANDLE HB_THREAD_HANDLE; typedef CRITICAL_SECTION HB_RAWCRITICAL_T; typedef HANDLE HB_OSCOND_T; -# define HB_THREAD_STARTFUNC( func ) unsigned __stdcall func( void * Cargo ) -# define HB_THREAD_END _endthreadex( 0 ); return 0; -# define HB_THREAD_RAWEND return 0; +# if defined( HB_OS_WIN_CE ) && \ + ( defined( __MINGW32CE__ ) && !defined( __MSVCRT__ ) ) +# define HB_THREAD_RAWWINAPI +# endif + +# if defined( HB_THREAD_RAWWINAPI ) + typedef DWORD HB_THREAD_ID; +# define HB_THREAD_STARTFUNC( func ) DWORD WINAPI func( void * Cargo ) +# define HB_THREAD_END ExitThread( 0 ); return 0; +# else + typedef unsigned HB_THREAD_ID; +# define HB_THREAD_STARTFUNC( func ) unsigned __stdcall func( void * Cargo ) +# define HB_THREAD_END _endthreadex( 0 ); return 0; +# endif +# define HB_THREAD_RAWEND return 0; # define HB_THREAD_SELF() GetCurrentThreadId() # define HB_CRITICAL_INITVAL { 0, 0, 0, 0, 0, 0 } diff --git a/harbour/source/vm/thread.c b/harbour/source/vm/thread.c index 0afac0d121..660a652c7a 100644 --- a/harbour/source/vm/thread.c +++ b/harbour/source/vm/thread.c @@ -774,7 +774,11 @@ HB_THREAD_HANDLE hb_threadCreate( HB_THREAD_ID * th_id, PHB_THREAD_STARTFUNC sta *th_id = ( HB_THREAD_ID ) 0; th_h = *th_id; #elif defined( HB_OS_WIN ) - th_h = ( HANDLE ) _beginthreadex( NULL, 0, start_func, Cargo, 0, th_id ); +# if defined( HB_THREAD_RAWWINAPI ) + th_h = CreateThread( NULL, 0, start_func, Cargo, 0, th_id ); +# else + th_h = ( HANDLE ) _beginthreadex( NULL, 0, start_func, Cargo, 0, th_id ); +# endif if( !th_h ) *th_id = ( HB_THREAD_ID ) 0; #elif defined( HB_OS_OS2 )