Revert "Implemented hacky fix for races in CoyoteRuntime.Dispose"

This reverts commit 151f437e5e.
This commit is contained in:
Aditya Senthilnathan 2022-10-12 13:05:09 +05:30
Родитель 151f437e5e
Коммит 4d808ece1f
1 изменённых файлов: 17 добавлений и 25 удалений

Просмотреть файл

@ -76,11 +76,6 @@ namespace Microsoft.Coyote.Runtime
/// </summary>
internal readonly Guid Id;
/// <summary>
/// Object that is used to synchronize access to the runtime.
/// </summary>
private readonly object RuntimeLock;
/// <summary>
/// The configuration used by the runtime.
/// </summary>
@ -297,7 +292,6 @@ namespace Microsoft.Coyote.Runtime
this.Configuration = configuration;
this.Scheduler = scheduler;
this.RuntimeLock = new object();
this.SyncObject = new object();
this.OperationIdCounter = 0;
this.IsRunning = true;
@ -2412,28 +2406,26 @@ namespace Microsoft.Coyote.Runtime
if (disposing)
{
RuntimeProvider.Deregister(this.Id);
using (SynchronizedSection.Enter(this.RuntimeLock))
foreach (var op in this.OperationMap.Values)
{
foreach (var op in this.OperationMap.Values)
{
op.Dispose();
}
this.ThreadPool.Clear();
this.OperationMap.Clear();
this.ControlledThreads.Clear();
this.ControlledTasks.Clear();
this.UncontrolledTasks.Clear();
this.UncontrolledInvocations.Clear();
this.DefaultActorExecutionContext.Dispose();
this.ControlledTaskScheduler.Dispose();
this.SyncContext.Dispose();
this.DeadlockMonitor.Dispose();
this.SpecificationMonitors.Clear();
this.TaskLivenessMonitors.Clear();
op.Dispose();
}
this.ThreadPool.Clear();
this.OperationMap.Clear();
this.ControlledThreads.Clear();
this.ControlledTasks.Clear();
this.UncontrolledTasks.Clear();
this.UncontrolledInvocations.Clear();
this.DefaultActorExecutionContext.Dispose();
this.ControlledTaskScheduler.Dispose();
this.SyncContext.Dispose();
this.DeadlockMonitor.Dispose();
this.SpecificationMonitors.Clear();
this.TaskLivenessMonitors.Clear();
if (this.SchedulingPolicy is SchedulingPolicy.Interleaving)
{
// Note: this makes it possible to run a Controlled unit test followed by a production