2009-11-18 16:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbthread.h
* minor cleanup in comment
* harbour/src/vm/dlmalloc.c
* use harbour spinlocks in windows builds to eliminate calling
InterlockedCompareExchange[Pointer]() function
* harbour/include/hbstack.h
! disabled TLS ASM inline code which seems to not work with Win9x.
This commit is contained in:
@@ -17,6 +17,17 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-11-18 16:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbthread.h
|
||||
* minor cleanup in comment
|
||||
|
||||
* harbour/src/vm/dlmalloc.c
|
||||
* use harbour spinlocks in windows builds to eliminate calling
|
||||
InterlockedCompareExchange[Pointer]() function
|
||||
|
||||
* harbour/include/hbstack.h
|
||||
! disabled TLS ASM inline code which seems to not work with Win9x.
|
||||
|
||||
2009-11-18 16:00 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* include/hbapi.h
|
||||
* Changed HB_ERRCODE to be 'insigned int' (was USHORT).
|
||||
|
||||
@@ -201,7 +201,7 @@ typedef struct
|
||||
# else
|
||||
extern HB_TLS_KEY hb_stack_key;
|
||||
# if defined( __BORLANDC__ ) && defined( HB_STACK_PRELOAD ) && \
|
||||
!defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE )
|
||||
!defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE ) && 0
|
||||
static __inline void * hb_stack_ptr_from_tls( void )
|
||||
{
|
||||
/* mov ecx,hb_stack_key */
|
||||
@@ -215,7 +215,7 @@ typedef struct
|
||||
}
|
||||
# define hb_stack_ptr_get() hb_stack_ptr_from_tls()
|
||||
# elif defined( __MINGW32__ ) && \
|
||||
!defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE )
|
||||
!defined( HB_OS_WIN_64 ) && !defined( HB_OS_WIN_CE ) && 0
|
||||
static __inline__ __attribute__ ((pure, malloc)) void * hb_stack_ptr_from_tls( void )
|
||||
{
|
||||
void * p;
|
||||
|
||||
@@ -430,7 +430,7 @@ extern BOOL hb_threadMutexSyncWait( PHB_ITEM pItemMtx, ULONG ulMilliSec, PHB_ITE
|
||||
#if defined( HB_NO_TLS ) || defined( HB_TASK_THREAD )
|
||||
# undef HB_USE_TLS
|
||||
#elif !defined( HB_USE_TLS )
|
||||
/* enable native compiler TLS support be default for this compilers
|
||||
/* enable native compiler TLS support by default for this compilers
|
||||
* which are known that it will work correctly
|
||||
*/
|
||||
# if defined( _MSC_VER ) && !defined( __POCC__ ) && !defined( __XCC__ )
|
||||
|
||||
@@ -1395,45 +1395,47 @@ static int win32munmap(void* ptr, size_t size) {
|
||||
unique mparams values are initialized only once.
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef HB_OS_OS2
|
||||
#include "hbthread.h"
|
||||
#include "hbatomic.h"
|
||||
#ifdef HB_SPINLOCK_T
|
||||
#if defined( HB_OS_OS2 ) || defined( HB_OS_WIN )
|
||||
# ifndef HB_SPINLOCK_USE
|
||||
# define HB_SPINLOCK_USE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HB_SPINLOCK_USE
|
||||
# include "hbthread.h"
|
||||
# include "hbatomic.h"
|
||||
#endif
|
||||
|
||||
#ifndef HB_SPINLOCK_T
|
||||
# undef HB_SPINLOCK_USE
|
||||
#endif
|
||||
|
||||
#ifdef HB_SPINLOCK_USE
|
||||
|
||||
#define MLOCK_T HB_SPINLOCK_T
|
||||
#define INITIAL_LOCK(l) *(l)=HB_SPINLOCK_INIT
|
||||
#define ACQUIRE_LOCK(l) HB_SPINLOCK_ACQUIRE(l)
|
||||
#define RELEASE_LOCK(l) HB_SPINLOCK_RELEASE(l)
|
||||
#define MLOCK_INIT HB_SPINLOCK_INIT
|
||||
|
||||
#elif defined( HB_OS_OS2 )
|
||||
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex = HB_SPINLOCK_INIT;
|
||||
#endif /* HAVE_MORECORE */
|
||||
static MLOCK_T magic_init_mutex = HB_SPINLOCK_INIT;
|
||||
#else /* !HB_SPINLOCK_T */
|
||||
#define MLOCK_T HB_RAWCRITICAL_T
|
||||
#define INITIAL_LOCK(l) HB_CRITICAL_INIT(*(l))
|
||||
#define ACQUIRE_LOCK(l) HB_CRITICAL_LOCK(*(l))
|
||||
#define RELEASE_LOCK(l) HB_CRITICAL_UNLOCK(*(l))
|
||||
#define MLOCK_INIT { 0 }
|
||||
|
||||
#elif !defined( WIN32 )
|
||||
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex;
|
||||
#endif /* HAVE_MORECORE */
|
||||
static MLOCK_T magic_init_mutex;
|
||||
#endif /* HB_SPINLOCK_T */
|
||||
#else /* !OS2 */
|
||||
/* By default use posix locks */
|
||||
#include <pthread.h>
|
||||
#define MLOCK_T pthread_mutex_t
|
||||
#define INITIAL_LOCK(l) pthread_mutex_init(l, NULL)
|
||||
#define ACQUIRE_LOCK(l) pthread_mutex_lock(l)
|
||||
#define RELEASE_LOCK(l) pthread_mutex_unlock(l)
|
||||
#define MLOCK_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif /* HAVE_MORECORE */
|
||||
|
||||
static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
#endif /* OS2 */
|
||||
#else /* WIN32 */
|
||||
/*
|
||||
Because lock-protected regions have bounded times, and there
|
||||
@@ -1461,12 +1463,15 @@ static void win32_release_lock (MLOCK_T *sl) {
|
||||
#define INITIAL_LOCK(l) *(l)=0
|
||||
#define ACQUIRE_LOCK(l) win32_acquire_lock(l)
|
||||
#define RELEASE_LOCK(l) win32_release_lock(l)
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex;
|
||||
#endif /* HAVE_MORECORE */
|
||||
static MLOCK_T magic_init_mutex;
|
||||
#define MLOCK_INIT 0
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#if HAVE_MORECORE
|
||||
static MLOCK_T morecore_mutex = MLOCK_INIT;
|
||||
#endif /* HAVE_MORECORE */
|
||||
static MLOCK_T magic_init_mutex = MLOCK_INIT;
|
||||
|
||||
#define USE_LOCK_BIT (2U)
|
||||
#else /* USE_LOCKS */
|
||||
#define USE_LOCK_BIT (0U)
|
||||
|
||||
Reference in New Issue
Block a user