diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-01-24 22:36:25 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-01-24 22:37:09 +0000 |
commit | 7dbd2a0a6d983bdd14bf7a022c0199fde76e143a (patch) | |
tree | 596445014cd566d22e933af4832c77d2b6a00e47 /vcl/headless | |
parent | c2112c7ce19fbdbc285d34fe8122754fb6654adb (diff) |
android: re-factor headless a little, and start on the mainloop
Diffstat (limited to 'vcl/headless')
-rw-r--r-- | vcl/headless/svpinst.cxx | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 9de3f8259968..56ea818af6bc 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -325,25 +325,32 @@ void SvpSalInstance::Yield( bool bWait, bool bHandleAllCurrentEvents ) else nTimeoutMS = -1; // wait until something happens - // release yield mutex - nAcquireCount = ReleaseYieldMutex(); - // poll - struct pollfd aPoll; - aPoll.fd = m_pTimeoutFDS[0]; - aPoll.events = POLLIN; - aPoll.revents = 0; - poll( &aPoll, 1, nTimeoutMS ); - - // acquire yield mutex again - AcquireYieldMutex( nAcquireCount ); - - // clean up pipe - if( (aPoll.revents & POLLIN) != 0 ) - { - int buffer; - while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0) - continue; - } + DoReleaseYield(nTimeoutMS); + } +} + +void SvpSalInstance::DoReleaseYield( int nTimeoutMS ) +{ + // poll + struct pollfd aPoll; + aPoll.fd = m_pTimeoutFDS[0]; + aPoll.events = POLLIN; + aPoll.revents = 0; + + // release yield mutex + sal_uLong nAcquireCount = ReleaseYieldMutex(); + + poll( &aPoll, 1, nTimeoutMS ); + + // acquire yield mutex again + AcquireYieldMutex( nAcquireCount ); + + // clean up pipe + if( (aPoll.revents & POLLIN) != 0 ) + { + int buffer; + while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0) + continue; } } |