2009-08-10 11:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbatomic.h
% added architecture independent support for atomic operations and
spinlocks in all SunOS builds
* harbour/source/vm/dynlibhb.c
! reenabled dlopen interface for Sun C compilers
* enabled dlopen interface for SunOS builds
This commit is contained in:
@@ -17,6 +17,15 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-08-10 11:07 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbatomic.h
|
||||
% added architecture independent support for atomic operations and
|
||||
spinlocks in all SunOS builds
|
||||
|
||||
* harbour/source/vm/dynlibhb.c
|
||||
! reenabled dlopen interface for Sun C compilers
|
||||
* enabled dlopen interface for SunOS builds
|
||||
|
||||
2009-08-10 03:58 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* make_gnu_os2.cmd
|
||||
* make_gnu.bat
|
||||
|
||||
@@ -59,6 +59,8 @@
|
||||
# include <windows.h>
|
||||
#elif defined( HB_OS_DARWIN )
|
||||
# include <libkern/OSAtomic.h>
|
||||
#elif defined( HB_OS_SUNOS )
|
||||
# include <atomic.h>
|
||||
#endif
|
||||
#if defined( __SVR4 )
|
||||
# include <thread.h>
|
||||
@@ -368,9 +370,9 @@ HB_EXTERN_BEGIN
|
||||
# define HB_SPINLOCK_ACQUIRE(l) do { \
|
||||
for( ;; ) \
|
||||
{ \
|
||||
if( !InterlockedExchange( (LONG *)(l), 1 ) ) \
|
||||
if( !InterlockedExchange( (l), 1 ) ) \
|
||||
break; \
|
||||
if( !InterlockedExchange( (LONG *)(l), 1 ) ) \
|
||||
if( !InterlockedExchange( (l), 1 ) ) \
|
||||
break; \
|
||||
Sleep( 0 ); \
|
||||
} \
|
||||
@@ -411,6 +413,37 @@ HB_EXTERN_BEGIN
|
||||
# define HB_SPINLOCK_RELEASE(l) OSSpinLockUnlock(l)
|
||||
# endif
|
||||
|
||||
#elif defined( HB_OS_SUNOS )
|
||||
|
||||
/* Atomic operations on memory reference counters */
|
||||
# if !defined( HB_ATOM_INC ) || !defined( HB_ATOM_DEC )
|
||||
# undef HB_ATOM_DEC
|
||||
# undef HB_ATOM_INC
|
||||
# undef HB_ATOM_GET
|
||||
# undef HB_ATOM_SET
|
||||
# define HB_ATOM_INC( p ) atomic_inc_ulong((ulong_t *)(p))
|
||||
# define HB_ATOM_DEC( p ) atomic_dec_ulong_nv((ulong_t *)(p))
|
||||
# define HB_ATOM_GET( p ) (*(ulong_t volatile *)(p))
|
||||
# define HB_ATOM_SET( p, n ) do { *((ulong_t volatile *)(p)) = (n); } while(0)
|
||||
# endif
|
||||
|
||||
/* Spin locks */
|
||||
# if !defined( HB_SPINLOCK_T )
|
||||
# define HB_SPINLOCK_T volatile uint_t
|
||||
# define HB_SPINLOCK_INIT 0
|
||||
# define HB_SPINLOCK_ACQUIRE(l) do { \
|
||||
for( ;; ) \
|
||||
{ \
|
||||
if( !atomic_swap_uint( (l), 1 ) ) \
|
||||
break; \
|
||||
if( !atomic_swap_uint( (l), 1 ) ) \
|
||||
break; \
|
||||
thr_yield(); \
|
||||
} \
|
||||
} while(0)
|
||||
# define HB_SPINLOCK_RELEASE(l) do { *(l) = 0; } while(0)
|
||||
# endif
|
||||
|
||||
#endif /* HB_OS_??? */
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -64,7 +64,13 @@
|
||||
#include "hbstack.h"
|
||||
#include "hbvm.h"
|
||||
|
||||
#if defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) && !defined( __SUNPRO_C ) && !defined( __SUNPRO_CC )
|
||||
#if !defined( HB_HAS_DLFCN ) && \
|
||||
( ( defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) ) || \
|
||||
defined( HB_OS_SUNOS ) )
|
||||
# define HB_HAS_DLFCN
|
||||
#endif
|
||||
|
||||
#if defined( HB_HAS_DLFCN )
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
@@ -104,7 +110,7 @@ HB_FUNC( HB_LIBLOAD )
|
||||
( PCSZ ) hb_parc( 1 ), &hDynModule ) == NO_ERROR )
|
||||
hDynLib = ( void * ) hDynModule;
|
||||
}
|
||||
#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) && !defined( __SUNPRO_C ) && !defined( __SUNPRO_CC )
|
||||
#elif defined( HB_HAS_DLFCN )
|
||||
hDynLib = ( void * ) dlopen( hb_parc( 1 ), RTLD_LAZY | RTLD_GLOBAL );
|
||||
#endif
|
||||
/* set real marker */
|
||||
@@ -144,7 +150,7 @@ HB_FUNC( HB_LIBFREE )
|
||||
fResult = FreeLibrary( ( HMODULE ) hDynLib );
|
||||
#elif defined( HB_OS_OS2 )
|
||||
fResult = DosFreeModule( ( HMODULE ) hDynLib ) == NO_ERROR;
|
||||
#elif defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) && !defined( __SUNPRO_C ) && !defined( __SUNPRO_CC )
|
||||
#elif defined( HB_HAS_DLFCN )
|
||||
fResult = dlclose( hDynLib ) == 0;
|
||||
#endif
|
||||
}
|
||||
@@ -155,7 +161,7 @@ HB_FUNC( HB_LIBFREE )
|
||||
|
||||
HB_FUNC( HB_LIBERROR )
|
||||
{
|
||||
#if defined( HB_OS_LINUX ) && !defined( __WATCOMC__ ) && !defined( __SUNPRO_C ) && !defined( __SUNPRO_CC )
|
||||
#if defined( HB_HAS_DLFCN )
|
||||
hb_retc( dlerror() );
|
||||
#else
|
||||
hb_retc_null();
|
||||
|
||||
Reference in New Issue
Block a user