Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2013-12-04 23:38:26 +0400
committerRodrigo Kumpera <kumpera@gmail.com>2013-12-05 23:11:58 +0400
commite90df12b263612ee8b9e8c6a3382f96e32768926 (patch)
tree2c4ea17193ac798db902e0d369f8170177c6268f
parentf274be9b817942f40ed187b355d62389e4407580 (diff)
[runtime]Add the marshal lock to the lock tracer.
-rw-r--r--data/lock-decoder/LockTracerDecoder.cs2
-rw-r--r--mono/metadata/lock-tracer.h1
-rw-r--r--mono/metadata/marshal.c9
3 files changed, 8 insertions, 4 deletions
diff --git a/data/lock-decoder/LockTracerDecoder.cs b/data/lock-decoder/LockTracerDecoder.cs
index f786e6b81dc..abd4e5f89fc 100644
--- a/data/lock-decoder/LockTracerDecoder.cs
+++ b/data/lock-decoder/LockTracerDecoder.cs
@@ -122,6 +122,8 @@ public enum Lock {
DomainAssembliesLock,
DomainJitCodeHashLock,
IcallLock,
+ AssemblyBindingLock,
+ MarshalLock,
}
public class SimLock
diff --git a/mono/metadata/lock-tracer.h b/mono/metadata/lock-tracer.h
index b303f0fe81f..215b683ba4b 100644
--- a/mono/metadata/lock-tracer.h
+++ b/mono/metadata/lock-tracer.h
@@ -17,6 +17,7 @@ typedef enum {
DomainJitCodeHashLock,
IcallLock,
AssemblyBindingLock,
+ MarshalLock
} RuntimeLocks;
#ifdef LOCK_TRACER
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index dddd049d4b0..fa50598f7d7 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -72,11 +72,12 @@ typedef struct _MonoRemotingMethods MonoRemotingMethods;
/*
* This mutex protects the various marshalling related caches in MonoImage
* and a few other data structures static to this file.
- * Note that when this lock is held it is not possible to take other runtime
- * locks like the loader lock.
+ *
+ * The marshal lock is a non-recursive complex lock that sits below the domain lock in the
+ * runtime locking latice. Which means it can take simple locks suck as the image lock.
*/
-#define mono_marshal_lock() EnterCriticalSection (&marshal_mutex)
-#define mono_marshal_unlock() LeaveCriticalSection (&marshal_mutex)
+#define mono_marshal_lock() mono_locks_acquire (&marshal_mutex, MarshalLock)
+#define mono_marshal_unlock() mono_locks_release (&marshal_mutex, MarshalLock)
static CRITICAL_SECTION marshal_mutex;
static gboolean marshal_mutex_initialized;