private bool canGoTroughOrPush(GameObject collidingWith, Vector2 direction) { if (collidingWith) { BlockingObject blockingObject = collidingWith.GetComponent <BlockingObject>(); if (blockingObject) { if (blockingObject.CanBePushed) { float pushMoveSpeed = blockingObject.tryToPush(direction); if (pushMoveSpeed < 0) { return(false); } else { oldMoveSpeed = moveSpeed; moveSpeed = pushMoveSpeed; return(true); } } return(blockingObject.CanBeTraversed); } else { return(false); } } else { return(true); // Is not colliding with anything } }
/// <summary> /// Create instance of our version BlockingObject. /// </summary> /// <param name="bo">Instance of BlockingObject from ClrHeap.</param> /// <param name="blockInfoNdx">Index of the owners,waiters information.</param> /// <param name="typeId">Type of this object.</param> public ClrtBlkObject(BlockingObject bo, int blockInfoNdx, int typeId) { _address = bo.Object; _recursionCnt = bo.RecursionCount; _blkReason = bo.Reason; _taken = bo.Taken; _index = blockInfoNdx; _typeId = typeId; }
public LockConvoyIssue(BlockingObject blockingObject) { Title = $"Lock convoy of {blockingObject.Waiters.Count} waiting and one locking threads"; var objRef = blockingObject.Object; Message = string.Join("\n", new[] { $"Lock convoy to object ref [{objRef}] of type {blockingObject.Owner.Runtime.Heap.GetObjectType(objRef)}", $"Locking thread id [{blockingObject.Owner.OSThreadId}]", "Waiting threads ids:" } .Concat(blockingObject.Waiters .Select(t => t.OSThreadId.ToString()))); }
public BlockingObjectInformation(ClrDump clrDump, BlockingObject blockingObject) { ClrDump = clrDump; BlockingObject = blockingObject; OwnersId = blockingObject.HasSingleOwner && blockingObject.Owner != null ? new HashSet <int> { blockingObject.Owner.ManagedThreadId } : new HashSet <int>(blockingObject.Owners.Where(thread => thread != null).Select(thread => thread.ManagedThreadId)); WaitersId = blockingObject.Waiters != null ? new HashSet <int>(blockingObject.Waiters.Where(thread => thread != null).Select(thread => thread.ManagedThreadId)) : new HashSet <int>(); }
public SDBlockingObject(BlockingObject obj) { foreach (ClrThread waiter in obj.Waiters?.Where(t => t != null) ?? new ClrThread[0]) { this.WaiterOSThreadIds.Add(waiter.OSThreadId); } foreach (ClrThread owner in obj.Owners?.Where(t => t != null) ?? new ClrThread[0]) { this.OwnerOSThreadIds.Add(owner.OSThreadId); } // convert reason to int, so it can be case to our UnifiedBlockingReason Reason = (UnifiedBlockingReason)((int)obj.Reason); RecursionCount = obj.RecursionCount; ManagedObjectAddress = obj.Object; }
public UnifiedBlockingObject(BlockingObject obj) : this(BlockingObjectOrigin.ClrMD) { foreach (var owner in obj.Owners?.Where(o => o != null) ?? new ClrThread[0]) { OwnerOSThreadIds.Add(owner.OSThreadId); } foreach (var waiter in obj.Waiters?.Where(w => w != null) ?? new ClrThread[0]) { WaiterOSThreadIds.Add(waiter.OSThreadId); } Reason = (UnifiedBlockingReason)((int)obj.Reason); RecursionCount = obj.RecursionCount; ManagedObjectAddress = obj.Object; Type = UnifiedBlockingType.ClrBlockingObject; }
public static SDBlockingObject ToSDModel(this BlockingObject obj) { var model = new SDBlockingObject(); foreach (ClrThread waiter in obj.Waiters?.Where(t => t != null) ?? new ClrThread[0]) { model.WaiterOSThreadIds.Add(waiter.OSThreadId); } foreach (ClrThread owner in obj.Owners?.Where(t => t != null) ?? new ClrThread[0]) { model.OwnerOSThreadIds.Add(owner.OSThreadId); } // convert reason to int, so it can be case to our UnifiedBlockingReason model.Reason = (UnifiedBlockingReason)((int)obj.Reason); model.RecursionCount = obj.RecursionCount; model.ManagedObjectAddress = obj.Object; return(model); }
private bool canGoTrough(GameObject collidingWith) { if (collidingWith) { BlockingObject blockingObject = collidingWith.GetComponent <BlockingObject>(); if (blockingObject) { return(blockingObject.CanBeTraversed); } else { return(false); } } else { return(true); // Is not colliding with anything } }
public int Add(Object blockingObject, ReasonForBlocking reasonForBlocking) { if (_blockingObjects == null) { _blockingObjects = new BlockingObject[InitialSize]; } int count = _count; if (count == _blockingObjects.Length) { int newSize = count + GrowBy; if (newSize > MaxSize) { return(-1); } Array.Resize <BlockingObject>(ref _blockingObjects, newSize); } _blockingObjects[count] = new BlockingObject(blockingObject, reasonForBlocking); _count++; return(count); }
public BlockingObjectInformation(ClrDump clrDump, BlockingObject blockingObject) { ClrDump = clrDump; BlockingObject = blockingObject; if (blockingObject.HasSingleOwner && blockingObject.Owner != null) { OwnersId = new HashSet <int>(); OwnersId.Add(blockingObject.Owner.ManagedThreadId); } else { OwnersId = new HashSet <int>(blockingObject.Owners.Where(thread => thread != null).Select(thread => thread.ManagedThreadId)); } if (blockingObject.Waiters != null) { WaitersId = new HashSet <int>(blockingObject.Waiters.Where(thread => thread != null).Select(thread => thread.ManagedThreadId)); } else { WaitersId = new HashSet <int>(); } }
public int Add(Object blockingObject, ReasonForBlocking reasonForBlocking) { if (_blockingObjects == null) _blockingObjects = new BlockingObject[InitialSize]; int count = _count; if (count == _blockingObjects.Length) { int newSize = count + GrowBy; if (newSize > MaxSize) return -1; Array.Resize<BlockingObject>(ref _blockingObjects, newSize); } _blockingObjects[count] = new BlockingObject(blockingObject, reasonForBlocking); _count++; return count; }
/// <summary> /// Initializes a new instance of the <see cref="BlockingObjectAdapter" /> class. /// </summary> /// <param name="converter">The converter.</param> /// <param name="blockingObject">The blocking object.</param> /// <exception cref="ArgumentNullException">blockingObject</exception> /// <inheritdoc /> public BlockingObjectAdapter(IConverter converter, BlockingObject blockingObject) : base(converter) { BlockingObject = blockingObject ?? throw new ArgumentNullException(nameof(blockingObject)); }
internal void SetBlockingObjects(BlockingObject[] blobjs) { _blockingObjs = blobjs; }
public void RemoveBlockingObject(BlockingObject blockingObject) { this.blockingObjects.Remove(blockingObject); }
public void AddBlockingObject(BlockingObject blockingObject) { this.blockingObjects.Add(blockingObject); }