コード例 #1
0
ファイル: Instrument.cs プロジェクト: dannyfriar/runtime
        /// <summary>
        /// Publish is activating the instrument to start recording measurements and to allow listeners to start listening to such measurements.
        /// </summary>
        protected void Publish()
        {
            List <MeterListener>?allListeners = null;

            lock (Instrument.SyncObject)
            {
                if (Meter.Disposed || !Meter.AddInstrument(this))
                {
                    return;
                }

                allListeners = MeterListener.GetAllListeners();
            }

            if (allListeners is not null)
            {
                foreach (MeterListener listener in allListeners)
                {
                    listener.InstrumentPublished?.Invoke(this, listener);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Publish is activating the instrument to start recording measurements and to allow listeners to start listening to such measurements.
 /// </summary>
 protected void Publish()
 {
     Meter.AddInstrument(this);
     MeterListener.NotifyForPublishedInstrument(this);
 }