diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 335f5bf342..af5f3a8f90 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -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 diff --git a/harbour/examples/uhttpd2/umain.prg b/harbour/examples/uhttpd2/umain.prg index 806d4aa71a..15183424f7 100644 --- a/harbour/examples/uhttpd2/umain.prg +++ b/harbour/examples/uhttpd2/umain.prg @@ -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 diff --git a/harbour/include/hbextern.ch b/harbour/include/hbextern.ch index c763aa2216..e4817eccf0 100644 --- a/harbour/include/hbextern.ch +++ b/harbour/include/hbextern.ch @@ -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 diff --git a/harbour/source/vm/thread.c b/harbour/source/vm/thread.c index 39c1fe6242..8d106c628e 100644 --- a/harbour/source/vm/thread.c +++ b/harbour/source/vm/thread.c @@ -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 ); + } } }