On Tue, 24 Nov 2009, Maurilio Longo wrote:

Hi,

> hbmk2 fails with an exception inside harbourm.dll.
> hbtest and hbrun, instead, work flawlessly.
> What can it be?

Only HBMK2 uses MT HVM so probably code for MT locks inside
DLMALLOC in OS2 builds is broken. It should be easy to fix it.
Depending on available atomic macros one of two versions is used,
see dlmalloc[1467]

   #ifdef HB_SPINLOCK_USE

   static int spin_acquire_lock( HB_SPINLOCK_T *l )
   {
      HB_SPINLOCK_ACQUIRE( l );
      return 0;
   }

   #define MLOCK_T HB_SPINLOCK_T
   #define INITIAL_LOCK(l)      *(l)=HB_SPINLOCK_INIT
   #define ACQUIRE_LOCK(l)      spin_acquire_lock(l)
   #define RELEASE_LOCK(l)      HB_SPINLOCK_RELEASE(l)
   #define MLOCK_INIT           HB_SPINLOCK_INIT

   #elif defined( HB_OS_OS2 )

   #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 you are using o...@x86 and GCC then the first version (HB_SPINLOCK_USE)
should be enabled. This code is used also on other platforms so it should
work without any problems so maybe in OS2 builds HB_CPU_X86 is not set
(BTW I'll commit some minor modification to the code which sets this macro
in a while). The second version inside HB_OS_OS2 section is not tested at
all and it's highly possible that it does not work. Can you check which
version is used in your build?
Just simply add:
   int version_HB_SPINLOCK_USE;
and:
   int version_HB_OS_OS2;
to above code and check which variable will be reported as unused.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to