User: kz      
Date: 2008-03-06 18:12:42+0000
Modified:
   dba/dbaccess/source/ui/browser/AsyncronousLink.cxx

Log:
 INTEGRATION: CWS odbmacros2 (1.6.198); FILE MERGED
 2008/01/26 21:17:14 fs 1.6.198.1: some re-factoring

File Changes:

Directory: /dba/dbaccess/source/ui/browser/
===========================================

File [changed]: AsyncronousLink.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/AsyncronousLink.cxx?r1=1.6&r2=1.7
Delta lines:  +13 -35
---------------------
--- AsyncronousLink.cxx 2006-09-17 06:55:56+0000        1.6
+++ AsyncronousLink.cxx 2008-03-06 18:12:40+0000        1.7
@@ -51,54 +51,32 @@
 using namespace dbaui;
 DBG_NAME(OAsyncronousLink)
 //------------------------------------------------------------------
-OAsyncronousLink::OAsyncronousLink(const Link& _rHandler, ::vos::OMutex* 
_pEventSafety, ::vos::OMutex* _pDestructionSafety)
+OAsyncronousLink::OAsyncronousLink( const Link& _rHandler )
        :m_aHandler(_rHandler)
-       ,m_pEventSafety(NULL)
-       ,m_pDestructionSafety(NULL)
-       ,m_bOwnMutexes(FALSE)
+       ,m_aEventSafety()
+       ,m_aDestructionSafety()
        ,m_nEventId(0)
 {
     DBG_CTOR(OAsyncronousLink,NULL);
-
-       if (_pEventSafety && _pDestructionSafety)
-       {
-               m_pEventSafety = _pEventSafety;
-               m_pDestructionSafety = _pDestructionSafety;
-               m_bOwnMutexes = FALSE;
-       }
-       else
-       {
-               m_pEventSafety = new ::vos::OMutex;
-               m_pDestructionSafety = new ::vos::OMutex;
-               m_bOwnMutexes = TRUE;
-       }
 }
 
 //------------------------------------------------------------------
 OAsyncronousLink::~OAsyncronousLink()
 {
        {
-               ::vos::OGuard aEventGuard(*m_pEventSafety);
-               if (m_nEventId)
+               ::osl::MutexGuard aEventGuard( m_aEventSafety );
+               if ( m_nEventId )
                        Application::RemoveUserEvent(m_nEventId);
                m_nEventId = 0;
        }
 
        {
-               ::vos::OGuard aDestructionGuard(*m_pDestructionSafety);
+               ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety );
                // this is just for the case we're deleted while another thread 
just handled the event :
                // if this other thread called our link while we were deleting 
the event here, the
                // link handler blocked. With leaving the above block it 
continued, but now we are prevented
                // to leave this destructor 'til the link handler recognizes 
that nEvent == 0 and leaves.
        }
-       if (m_bOwnMutexes)
-       {
-               delete m_pEventSafety;
-               delete m_pDestructionSafety;
-       }
-       m_pEventSafety = NULL;
-       m_pDestructionSafety = NULL;
-
     DBG_DTOR(OAsyncronousLink,NULL);
 }
 
@@ -106,7 +84,7 @@
 //------------------------------------------------------------------
 void OAsyncronousLink::Call(void* /*_pArgument*/)
 {
-       ::vos::OGuard aEventGuard(*m_pEventSafety);
+       ::osl::MutexGuard aEventGuard( m_aEventSafety );
        if (m_nEventId)
                Application::RemoveUserEvent(m_nEventId);
        m_nEventId = Application::PostUserEvent(LINK(this, OAsyncronousLink, 
OnAsyncCall));
@@ -115,9 +93,9 @@
 //------------------------------------------------------------------
 void OAsyncronousLink::CancelCall()
 {
-       ::vos::OGuard aEventGuard(*m_pEventSafety);
-       if (m_nEventId)
-               Application::RemoveUserEvent(m_nEventId);
+       ::osl::MutexGuard aEventGuard( m_aEventSafety );
+       if ( m_nEventId )
+               Application::RemoveUserEvent( m_nEventId );
        m_nEventId = 0;
 }
 
@@ -125,11 +103,11 @@
 IMPL_LINK(OAsyncronousLink, OnAsyncCall, void*, _pArg)
 {
        {
-               ::vos::OGuard aDestructionGuard(*m_pDestructionSafety);
+               ::osl::MutexGuard aDestructionGuard( m_aDestructionSafety );
                {
-                       ::vos::OGuard aEventGuard(*m_pEventSafety);
+                       ::osl::MutexGuard aEventGuard( m_aEventSafety );
                        if (!m_nEventId)
-                               // our destructor deleted the event just while 
we we're waiting for m_pEventSafety
+                               // our destructor deleted the event just while 
we we're waiting for m_aEventSafety
                                // -> get outta here
                                return 0;
                        m_nEventId = 0;




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to