2009-06-16 08:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* include/hbextern.ch
  * source/vm/thread.c
  * examples/uhttpd2/umain.prg
    * Replaced HB_MUTEXWAITERSCOUNT() with 
      HB_MUTEXQUEUEINFO( hMutex, [ @nWaitersCount ], [ @nQueueLength ] )
    ; Please review.
This commit is contained in:
Viktor Szakats
2009-06-16 06:51:12 +00:00
parent fed9d75a4c
commit 4dbccf8ead
4 changed files with 18 additions and 5 deletions

View File

@@ -17,6 +17,14 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-16 08:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbextern.ch
* source/vm/thread.c
* examples/uhttpd2/umain.prg
* Replaced HB_MUTEXWAITERSCOUNT() with
HB_MUTEXQUEUEINFO( hMutex, [ @nWaitersCount ], [ @nQueueLength ] )
; Please review.
2009-06-16 08:03 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg
+ If HB_COMPILER is mingw/mingw64/pocc64, architecture

View File

@@ -82,6 +82,7 @@ RETURN UHttpd()
METHOD Run() CLASS UHttpd
LOCAL hSocket, aRemote, nI, aThreads, aI
LOCAL nWaiters
IF ! HB_MTVM()
Self:cError := "Multithread support required"
@@ -147,9 +148,10 @@ LOCAL hSocket, aRemote, nI, aThreads, aI
IF hSocket == NIL
Self:LogError("[error] Accept error " + LTRIM(STR(socket_error())))
ELSE
hb_mutexQueueInfo( Self:hmtxQueue, @nWaiters )
? "New connection", hSocket
? "Waiters:", hb_mutexWaitersCount(Self:hmtxQueue)
IF hb_mutexWaitersCount(Self:hmtxQueue) < 2 .AND. LEN(aThreads) < THREAD_COUNT_MAX
? "Waiters:", nWaiters
IF nWaiters < 2 .AND. LEN(aThreads) < THREAD_COUNT_MAX
/*
We need two threads in worst case. If first thread becomes a sessioned
thread, the second one will continue to serve sessionless requests for

View File

@@ -1015,7 +1015,7 @@ EXTERNAL HB_MUTEXNOTIFY
EXTERNAL HB_MUTEXNOTIFYALL
EXTERNAL HB_MUTEXSUBSCRIBE
EXTERNAL HB_MUTEXSUBSCRIBENOW
EXTERNAL HB_MUTEXWAITERSCOUNT
EXTERNAL HB_MUTEXQUEUEINFO
/* Codepage support */
EXTERNAL HB_CODEPAGE_BG866

View File

@@ -2318,7 +2318,7 @@ HB_FUNC( HB_MUTEXSUBSCRIBENOW )
}
}
HB_FUNC( HB_MUTEXWAITERSCOUNT )
HB_FUNC( HB_MUTEXQUEUEINFO )
{
PHB_ITEM pItem = hb_mutexParam( 1 );
@@ -2327,7 +2327,10 @@ HB_FUNC( HB_MUTEXWAITERSCOUNT )
PHB_MUTEX pMutex = hb_mutexPtr( pItem );
if( pMutex )
hb_retni( pMutex->waiters );
{
hb_storni( pMutex->waiters, 2 );
hb_stornl( pMutex->events ? hb_arrayLen( pMutex->events ) : 0, 3 );
}
}
}