summaryrefslogtreecommitdiff
path: root/vcl/inc/schedulerimpl.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/inc/schedulerimpl.hxx')
-rw-r--r--vcl/inc/schedulerimpl.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/vcl/inc/schedulerimpl.hxx b/vcl/inc/schedulerimpl.hxx
index 2c29de6a6b30..df10fc930bda 100644
--- a/vcl/inc/schedulerimpl.hxx
+++ b/vcl/inc/schedulerimpl.hxx
@@ -21,6 +21,8 @@
#define INCLUDED_VCL_INC_SCHEDULERIMPL_HXX
#include <salwtype.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/scheduler.hxx>
class Task;
@@ -35,6 +37,39 @@ struct ImplSchedulerData final
const char *GetDebugName() const;
};
+class SchedulerMutex final
+{
+ sal_uInt32 mnLockDepth;
+ osl::Mutex maMutex;
+
+public:
+ SchedulerMutex() : mnLockDepth( 0 ) {}
+
+ bool acquire( sal_uInt32 nLockCount = 1 );
+ sal_uInt32 release( bool bUnlockAll = false );
+ sal_uInt32 lockDepth() const { return mnLockDepth; }
+};
+
+class SchedulerGuard final
+{
+ bool mbLocked;
+
+public:
+ SchedulerGuard()
+ : mbLocked( false )
+ {
+ mbLocked = Scheduler::Lock();
+ assert( mbLocked );
+ }
+
+ ~SchedulerGuard()
+ {
+ if ( !mbLocked )
+ return;
+ Scheduler::Unlock();
+ }
+};
+
#endif // INCLUDED_VCL_INC_SCHEDULERIMPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */