コード例 #1
0
 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
     }
 }
コード例 #2
0
ファイル: ClrtBlkObject.cs プロジェクト: jerzy-d/MDRDesk
 /// <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;
 }
コード例 #3
0
        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())));
        }
コード例 #4
0
        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>();
        }
コード例 #5
0
        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;
        }
コード例 #6
0
ファイル: MixedStack.cs プロジェクト: tiandian/msos
        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;
        }
コード例 #7
0
ファイル: ModelHelpers.cs プロジェクト: Yathishns/superdump
        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);
        }
コード例 #8
0
ファイル: BlockingObject.cs プロジェクト: webocs/gmtk-jam2020
 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
     }
 }
コード例 #9
0
            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);
            }
コード例 #10
0
        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>();
            }
        }
コード例 #11
0
ファイル: Monitor.cs プロジェクト: nattress/corert
            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;
            }
コード例 #12
0
 /// <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));
 }
コード例 #13
0
ファイル: threads.cs プロジェクト: mwatts/clrmd
 internal void SetBlockingObjects(BlockingObject[] blobjs)
 {
     _blockingObjs = blobjs;
 }
コード例 #14
0
 public void RemoveBlockingObject(BlockingObject blockingObject)
 {
     this.blockingObjects.Remove(blockingObject);
 }
コード例 #15
0
 public void AddBlockingObject(BlockingObject blockingObject)
 {
     this.blockingObjects.Add(blockingObject);
 }