From 2dfbd35809ad9f3595e21137f6c63b72505bf50b Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 23 Sep 2002 10:13:51 +0000 Subject: [PATCH] Optimised analysis and sleeps. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@27 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm.cpp | 11 ++++++----- src/zm.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/zm.cpp b/src/zm.cpp index 470976629..02cf28499 100644 --- a/src/zm.cpp +++ b/src/zm.cpp @@ -1669,12 +1669,11 @@ void Monitor::DumpImage( Image *image ) const } } -void Monitor::Analyse() +bool Monitor::Analyse() { if ( shared_images->last_read_index == shared_images->last_write_index ) { - usleep( 10000 ); - return; + return( false ); } time_t now = time( 0 ); @@ -1753,6 +1752,8 @@ void Monitor::Analyse() shared_images->last_read_index = index%IMAGE_BUFFER_COUNT; image_count++; + + return( true ); } void Monitor::ReloadZones() @@ -1772,11 +1773,11 @@ int Monitor::Load( int device, Monitor **&monitors, bool capture ) static char sql[256]; if ( device == -1 ) { - sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'Disabled'" ); + sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'None'" ); } else { - sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'Disabled' and Device = %d", device ); + sprintf( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Colours, LabelFormat, LabelX, LabelY, WarmUpCount, PreEventCount, PostEventCount from Monitors where Function != 'None' and Device = %d", device ); } if ( mysql_query( &dbconn, sql ) ) { diff --git a/src/zm.h b/src/zm.h index fbceccb33..690411577 100644 --- a/src/zm.h +++ b/src/zm.h @@ -610,7 +610,7 @@ public: } void DumpImage( Image *image ) const; - void Analyse(); + bool Analyse(); void Adjust( double ratio ) {