summaryrefslogtreecommitdiff
path: root/toolkit/inc/toolkit/helper/solarrelease.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/inc/toolkit/helper/solarrelease.hxx')
-rw-r--r--toolkit/inc/toolkit/helper/solarrelease.hxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/toolkit/inc/toolkit/helper/solarrelease.hxx b/toolkit/inc/toolkit/helper/solarrelease.hxx
index d8938b41c220..e45a1b6ee2c3 100644
--- a/toolkit/inc/toolkit/helper/solarrelease.hxx
+++ b/toolkit/inc/toolkit/helper/solarrelease.hxx
@@ -41,15 +41,36 @@ namespace toolkit
class ReleaseSolarMutex
{
sal_uInt32 mnLockCount;
+ const bool mbRescheduleDuringAcquire;
+
public:
- ReleaseSolarMutex()
+ enum
{
- mnLockCount = Application::ReleaseSolarMutex();
+ RescheduleDuringAcquire = true
+ };
+
+ public:
+ ReleaseSolarMutex( const bool i_rescheduleDuringAcquire = false )
+ :mnLockCount( Application::ReleaseSolarMutex() )
+ ,mbRescheduleDuringAcquire( i_rescheduleDuringAcquire )
+ {
+
}
~ReleaseSolarMutex()
{
- Application::AcquireSolarMutex( mnLockCount );
+ if ( mnLockCount > 0 )
+ {
+ if ( mbRescheduleDuringAcquire )
+ {
+ while ( !Application::GetSolarMutex().tryToAcquire() )
+ {
+ Application::Reschedule();
+ }
+ --mnLockCount;
+ }
+ Application::AcquireSolarMutex( mnLockCount );
+ }
}
};