Kaydet (Commit) 9b518087 authored tarafından Michael Meeks's avatar Michael Meeks

move SalYieldMutexReleaser into a more sensible place

üst 10517629
......@@ -31,8 +31,27 @@
#include <vcl/sv.h>
#include <osl/thread.hxx>
#include <vclpluginapi.h>
#include <salinst.hxx>
#include <vcl/solarmutex.hxx>
#include <salinst.hxx>
#include <saldatabasic.hxx>
class VCL_DLLPUBLIC SalYieldMutexReleaser
{
sal_uLong m_nYieldCount;
public:
inline SalYieldMutexReleaser();
inline ~SalYieldMutexReleaser();
};
inline SalYieldMutexReleaser::SalYieldMutexReleaser()
{
m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
}
inline SalYieldMutexReleaser::~SalYieldMutexReleaser()
{
GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
}
class VCL_DLLPUBLIC SalYieldMutex : public vcl::SolarMutexObject
{
......
......@@ -104,24 +104,6 @@ inline void X11SalData::XError( Display *pDisplay, XErrorEvent *pEvent ) const
{ pXLib_->XError( pDisplay, pEvent ); }
#endif
class YieldMutexReleaser
{
sal_uLong m_nYieldCount;
public:
inline YieldMutexReleaser();
inline ~YieldMutexReleaser();
};
inline YieldMutexReleaser::YieldMutexReleaser()
{
m_nYieldCount = GetSalData()->m_pInstance->ReleaseYieldMutex();
}
inline YieldMutexReleaser::~YieldMutexReleaser()
{
GetSalData()->m_pInstance->AcquireYieldMutex( m_nYieldCount );
}
#endif // _SV_SALDATA_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -685,16 +685,6 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
if ( pEntry->HasPendingEvent() )
{
pEntry->HandleNextEvent();
// #63862# da jetzt alle user-events ueber die interne
// queue kommen, wird die Kontrolle analog zum select
// gesteuerten Zweig einmal bei bWait abgegeben
/* #i9277# do not reschedule since performance gets down the
the drain under heavy load
YieldMutexReleaser aReleaser;
if ( bWait ) osl_yieldThread();
*/
return;
}
}
......@@ -728,7 +718,7 @@ void SalXLib::Yield( bool bWait, bool bHandleAllCurrentEvents )
{
// release YieldMutex (and re-acquire at block end)
YieldMutexReleaser aReleaser;
SalYieldMutexReleaser aReleaser;
nFound = select( nFDs, &ReadFDS, NULL, &ExceptionFDS, pTimeout );
}
if( nFound < 0 ) // error
......
......@@ -563,15 +563,19 @@ GtkData::~GtkData()
Yield( true, true );
g_warning ("TESTME: We used to have a stop-timer here, but the central code should do this");
// sanity check: at this point nobody should be yielding, but wake them
// up anyway before the condition they're waiting on gets destroyed.
osl_setCondition( m_aDispatchCondition );
osl_acquireMutex( m_aDispatchMutex );
if (m_pUserEvent)
{
g_source_destroy (m_pUserEvent);
g_source_unref (m_pUserEvent);
m_pUserEvent = NULL;
}
// sanity check: at this point nobody should be yielding, but wake them
// up anyway before the condition they're waiting on gets destroyed.
osl_setCondition( m_aDispatchCondition );
osl_destroyCondition( m_aDispatchCondition );
osl_releaseMutex( m_aDispatchMutex );
osl_destroyMutex( m_aDispatchMutex );
}
......@@ -586,7 +590,7 @@ void GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
bool bWasEvent = false;
{
// release YieldMutex (and re-acquire at block end)
YieldMutexReleaser aReleaser;
SalYieldMutexReleaser aReleaser;
if( osl_tryToAcquireMutex( m_aDispatchMutex ) )
bDispatchThread = true;
else if( ! bWait )
......
......@@ -261,7 +261,7 @@ void KDEXLib::setupEventLoop()
#ifdef GLIB_EVENT_LOOP_SUPPORT
gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
{
YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
return old_gpoll( ufds, nfds, timeout );
}
#endif
......@@ -270,7 +270,7 @@ gint gpoll_wrapper( GPollFD* ufds, guint nfds, gint timeout )
int lo_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
const struct timeval *orig_timeout)
{
YieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
SalYieldMutexReleaser release; // release YieldMutex (and re-acquire at block end)
return qt_select( nfds, fdread, fdwrite, fdexcept, orig_timeout );
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment