本文整理汇总了C#中LogMessage.RemoveReference方法的典型用法代码示例。如果您正苦于以下问题:C# LogMessage.RemoveReference方法的具体用法?C# LogMessage.RemoveReference怎么用?C# LogMessage.RemoveReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogMessage
的用法示例。
在下文中一共展示了LogMessage.RemoveReference方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InnerDistributeMessage
protected void InnerDistributeMessage(ref LogMessage lm, int srcDistGroupID)
{
// all validation and testing of passed parameters is performed by caller
// message ptr is non-null, message type are enabled in group and distGroupID is known valid
PerDistGroupIDInfo srcDgInfo = distGroupIDInfoList[srcDistGroupID];
bool messageHasBeenReallocated = false;
// traverse groups to which this group is linked and deliver the message to each group's list of log message handlers.
foreach (PerDistGroupIDInfo dgInfo in srcDgInfo.LinkedDistGroupArray)
{
if (!srcDgInfo.ActiveLoggerConfig.SupportsReferenceCountedRelease && !messageHasBeenReallocated)
{
ReallocateMessageForNonRefCountedHandler(ref lm);
messageHasBeenReallocated = true;
}
// tell each of the log message handlers in this group to process this message
foreach (DistHandlerInfo dhInfo in dgInfo.distHandlerInfoList)
{
if (dhInfo.Valid && dhInfo.LoggerConfig.IsTypeEnabled(lm.MesgType))
dhInfo.LMH.HandleLogMessage(lm);
}
}
// release the message if we still have a handle to it
if (lm != null)
lm.RemoveReference(ref lm);
}
示例2: EnqueueMessageForDistribution
/// <summary>used to support QueuedLogger loggers. This method consumes the given message. The caller's handle will be nulled by this method.</summary>
public void EnqueueMessageForDistribution(ref LogMessage lm)
{
MessageQueue capturedMesgQueue = mesgQueue;
if (capturedMesgQueue == null)
{
StartQueuedMessageDelivery();
capturedMesgQueue = mesgQueue;
}
if (lm != null)
{
// enqueue the given message and then reset the pointer that was passed to us.
// (this method consumes the given message);
if (capturedMesgQueue != null)
capturedMesgQueue.EnqueueMesg(lm);
lm.RemoveReference(ref lm); // mesgQueue always adds a reference internally - as such we must explicitly remove the caller's reference before returing
}
}
示例3: EmitLogMessage
public override void EmitLogMessage(ref LogMessage mesg)
{
mq.InnerEnqueueMesg(mesg);
mesg.RemoveReference(ref mesg);
}
示例4: InnerTestAndDistributeMessage
protected void InnerTestAndDistributeMessage(ref LogMessage lm)
{
if (lm != null && lm.LoggerSourceInfo != null && lm.Emitted)
{
int lid = lm.LoggerSourceInfo.ID;
int dgid = DistGroupID_Invalid;
LoggerConfig dgConfig = LoggerConfig.None;
if (InnerIsLoggerIDValid(lid))
{
PerLoggerIDInfo lInfo = perLoggerIDInfoList [lid];
dgid = lInfo.distGroupID;
lInfo.lastDistributedMesgSeqNum = lm.SeqNum;
}
bool dgidValid = InnerIsDistGroupIDValid(dgid);
if (dgidValid)
dgConfig = distGroupIDInfoList [dgid].ActiveLoggerConfig;
bool msgEnabled = dgConfig.IsTypeEnabled(lm.MesgType);
if (msgEnabled && dgidValid)
InnerDistributeMessage(ref lm, dgid); // this may consume the message (and null our pointer)
}
if (lm != null)
lm.RemoveReference(ref lm);
}
示例5: EmitLogMessage
/// <summary>Handles emitting and consuming the given LogMessage. ref parameter lm will be set to null</summary>
public override void EmitLogMessage(ref LogMessage lm)
{
if (lm != null)
{
lm.NoteEmitted();
if (!loggerHasBeenShutdown)
{
if (!lmh.LoggerConfig.SupportsReferenceCountedRelease && lm.BelongsToPool)
dist.ReallocateMessageForNonRefCountedHandler(ref lm);
lmh.HandleLogMessage(lm);
}
lm.RemoveReference(ref lm);
}
}