private InitializeAsync ( |
||
cancellationToken | ||
Результат | Task |
public async Task DeleteAsync(CancellationToken cancellationToken = default(CancellationToken)) { Trace.Assert(UseCount > 0); await TaskUtilities.SwitchToBackgroundThread(); await _tracer.InitializeAsync(cancellationToken); string fileName = null; try { fileName = Path.GetFileName(Location.FileName); } catch (ArgumentException) { return; } if (--UseCount == 0) { _tracer.RemoveBreakpoint(this); var code = $"rtvs:::remove_breakpoint({fileName.ToRStringLiteral()}, {Location.LineNumber})"; try { await Tracer.Session.ExecuteAsync(code, cancellationToken); } catch (RException ex) { throw new InvalidOperationException(ex.Message, ex); } } }
/// <summary> /// Obtain an instance of <see cref="IRExecutionTracer"/> for the given <see cref="IRSession"/>. /// </summary> public static async Task<IRExecutionTracer> TraceExecutionAsync(this IRSession session, CancellationToken cancellationToken = default(CancellationToken)) { RExecutionTracer tracer; await _tracersSem.WaitAsync(cancellationToken).ConfigureAwait(false); try { if (!_tracers.TryGetValue(session, out tracer)) { tracer = new RExecutionTracer(session); await tracer.InitializeAsync(cancellationToken).ConfigureAwait(false); _tracers.Add(session, tracer); } session.Disposed += Session_Disposed; } finally { _tracersSem.Release(); } return tracer; }
/// <summary> /// Obtain an instance of <see cref="IRExecutionTracer"/> for the given <see cref="IRSession"/>. /// </summary> public static async Task <IRExecutionTracer> TraceExecutionAsync(this IRSession session, CancellationToken cancellationToken = default(CancellationToken)) { RExecutionTracer tracer; await _tracersSem.WaitAsync(cancellationToken).ConfigureAwait(false); try { if (!_tracers.TryGetValue(session, out tracer)) { tracer = new RExecutionTracer(session); await tracer.InitializeAsync(cancellationToken).ConfigureAwait(false); _tracers.Add(session, tracer); } session.Disposed += Session_Disposed; } finally { _tracersSem.Release(); } return(tracer); }