On Sat, 08 Nov 2008, David Arturo Macias Corona wrote:
> Error happen
> -----------------
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=1
> _hb_gettid()
> TID=2
> _hb_gettid()
> TID=2
> SYS1808:
> The process has stopped.  The software diagnostic
> code (exception code) is  0001.

So it's not exactly inside _hb_gettid(). Good I was afraid that
we will have to look for workaround to this function.

Let's check the whole mutex lock function.
I added 2 printf() calls to this function.

best regards,
Przemek



BOOL hb_threadMutexLock( PHB_ITEM pItem )
{
   PHB_MUTEX pMutex = hb_mutexPtr( pItem );
   BOOL fResult = FALSE;

   printf("1. hb_threadMutexLock()\r\n");fflush(stdout);

   if( pMutex )
   {
      if( HB_THREAD_EQUAL( pMutex->owner, HB_THREAD_SELF() ) )
      {
         pMutex->lock_count++;
         fResult = TRUE;
      }
      else
      {
         hb_vmUnlock();

#if !defined( HB_MT_VM )
         pMutex->lock_count = 1;
         pMutex->owner = HB_THREAD_SELF();
         fResult = TRUE;
#else
         HB_CRITICAL_LOCK( pMutex->mutex );
         while( pMutex->lock_count != 0 )
         {
            pMutex->lockers++;
#if defined( HB_PTHREAD_API )
            pthread_cond_wait( &pMutex->cond_l, &pMutex->mutex );
#else
            HB_CRITICAL_UNLOCK( pMutex->mutex );
            ( void ) HB_COND_WAIT( pMutex->cond_l );
            HB_CRITICAL_LOCK( pMutex->mutex );
#endif
            pMutex->lockers--;
         }
         pMutex->lock_count = 1;
         pMutex->owner = HB_THREAD_SELF();
         HB_CRITICAL_UNLOCK( pMutex->mutex );
         fResult = TRUE;
#endif
         hb_vmLock();
      }
   }

   printf("2. hb_threadMutexLock()\r\n");fflush(stdout);

   return fResult;
}
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to