summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sync.h
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/sync.h')
-rw-r--r--winsup/cygwin/sync.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h
index 441892a08..f8019a8fe 100644
--- a/winsup/cygwin/sync.h
+++ b/winsup/cygwin/sync.h
@@ -44,4 +44,28 @@ public:
static void set_exiting_thread () {exiting_thread = GetCurrentThreadId ();}
};
+class lock_process
+{
+ bool skip_unlock;
+ static muto locker;
+public:
+ static void init () {locker.init ("lock_process");}
+ lock_process (bool exiting = false)
+ {
+ locker.acquire ();
+ skip_unlock = exiting;
+ if (exiting && exit_state < ES_SET_MUTO)
+ {
+ exit_state = ES_SET_MUTO;
+ muto::set_exiting_thread ();
+ }
+ }
+ ~lock_process ()
+ {
+ if (!skip_unlock)
+ locker.release ();
+ }
+ friend class dtable;
+};
+
#endif /*_SYNC_H*/