Skip to content

Assemblymanager thread safety #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Nov 17, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
No need to support recursion, also lock when we get _list.Count
  • Loading branch information
abessen committed Oct 28, 2016
commit 6838be81c7beebed564c02f277e6ec33cbae697c
16 changes: 14 additions & 2 deletions src/runtime/assemblymanager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,10 +488,22 @@ private class AssemblyList : IEnumerable<Assembly>{

public AssemblyList(int capacity) {
_list = new List<Assembly>(capacity);
_lock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
_lock = new ReaderWriterLockSlim();
}

public int Count { get { return _list.Count; } }
public int Count
{
get
{
_lock.EnterReadLock();
try {
return _list.Count;
}
finally {
_lock.ExitReadLock();
}
}
}

public void Add(Assembly assembly) {
_lock.EnterWriteLock();
Expand Down