From 4754443b44db70fe4b0ef1a39b8ca1362675eafc Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 26 Mar 2003 11:06:31 +0000 Subject: INTEGRATION: CWS gh3 (1.1.12); FILE MERGED 2003/03/18 11:36:17 gh 1.1.12.2: added debug code 2003/02/24 12:57:35 gh 1.1.12.1: #107646#change idle handler to own Timer and call it less frequently and only when needed --- automation/source/server/server.cxx | 39 +++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'automation/source') diff --git a/automation/source/server/server.cxx b/automation/source/server/server.cxx index b2f79ee52f8d..56a135d598f2 100644 --- a/automation/source/server/server.cxx +++ b/automation/source/server/server.cxx @@ -2,9 +2,9 @@ * * $RCSfile: server.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mh $ $Date: 2002-11-18 15:28:47 $ + * last change: $Author: vg $ $Date: 2003-03-26 12:06:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,6 +59,9 @@ * ************************************************************************/ +// do not use Application Idle but AutoTimer instead +#define TIMERIDLE + #ifdef DEBUG #if defined(WNT) || defined(WNT) // #define CPP_EXCEPTIONS @@ -709,6 +712,11 @@ IMPL_LINK( ImplRemoteControl, CommandHdl, Application*, pApp ) // Schleift hier bis Befehl nicht zurückkommt, // Wird dann rekursiv über IdleHdl und PostUserEvent aufgerufen. { + m_bInsideExecutionLoop = TRUE; +#ifdef TIMERIDLE + m_aIdleTimer.Stop(); + m_aIdleTimer.Start(); +#endif StatementList *pC = StatementList::pFirst; // MessBox MB( pMainWin, WB_DEF_OK|WB_OK, "Pause ...", "... und Weiter" ); @@ -756,6 +764,8 @@ IMPL_LINK( ImplRemoteControl, CommandHdl, Application*, pApp ) for (int xx = 1;xx < 20;xx++) StatementList::NormalReschedule(); + + m_bInsideExecutionLoop = FALSE; } StatementList::nWindowWaitUId = 0; // Warten rücksetzen, da handler sowieso verlassen wird @@ -785,13 +795,18 @@ IMPL_LINK( ImplRemoteControl, QueCommandsEvent, CommunicationLink*, pCL ) BOOL ImplRemoteControl::QueCommands( ULONG nServiceId, SvStream *pIn ) { - // return TRUE; USHORT nId; if( !m_bIdleInserted ) { +#ifdef TIMERIDLE + m_aIdleTimer.SetTimeoutHdl( LINK( this, ImplRemoteControl, IdleHdl ) ); + m_aIdleTimer.SetTimeout( 1000 ); + m_aIdleTimer.Start(); +#else GetpApp()->InsertIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ), 1 ); +#endif m_bIdleInserted = TRUE; } @@ -862,7 +877,18 @@ BOOL ImplRemoteControl::QueCommands( ULONG nServiceId, SvStream *pIn ) m_pDbgWin->AddText( String::CreateFromInt64( nServiceId ) ); m_pDbgWin->AddText( " :\n" ); #endif - GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) ); + if ( !m_bInsideExecutionLoop ) + { +#ifdef DEBUG + m_pDbgWin->AddText( "Posting Event for CommandHdl.\n" ); +#endif + + GetpApp()->PostUserEvent( LINK( this, ImplRemoteControl, CommandHdl ) ); + } +#ifdef DEBUG + else + m_bInsideExecutionLoop = TRUE; +#endif return TRUE; } // BOOL ImplRemoteControl::QueCommands( ULONG nServiceId, SvStream *pIn ) @@ -881,6 +907,7 @@ void ImplRemoteControl::ExecuteURL( String &aURL ) ImplRemoteControl::ImplRemoteControl() : m_bIdleInserted( FALSE ) +, m_bInsideExecutionLoop( FALSE ) , pRetStream(NULL) #ifdef DEBUG , m_pDbgWin(NULL) @@ -948,7 +975,11 @@ ImplRemoteControl::~ImplRemoteControl() #endif if( m_bIdleInserted ) { +#ifdef TIMERIDLE + m_aIdleTimer.Stop(); +#else GetpApp()->RemoveIdleHdl( LINK( this, ImplRemoteControl, IdleHdl ) ); +#endif m_bIdleInserted = FALSE; } delete pServiceMgr; -- cgit v1.2.3