Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (DebuggeeId.Length != 0)
            {
                hash ^= DebuggeeId.GetHashCode();
            }
            if (WaitToken.Length != 0)
            {
                hash ^= WaitToken.GetHashCode();
            }
            if (SuccessOnTimeout != false)
            {
                hash ^= SuccessOnTimeout.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Frees the given token
 /// </summary>
 /// <param name="token">The token.</param>
 public void FreeToken(WaitToken token)
 {
     WaitToken t;
     bool      r = tokens.TryRemove(token.Id, out t);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Allocates a new wait token
        /// </summary>
        /// <returns></returns>
        public WaitToken AllocateToken()
        {
            var token = new WaitToken(Interlocked.Increment(ref nextId));

            return(tokens.AddOrUpdate(token.Id, token, (a, b) => { throw new Exception("Key should not already be present"); }));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Frees the given token
 /// </summary>
 /// <param name="token">The token.</param>
 public void FreeToken(WaitToken token)
 {
     WaitToken t;
     bool r = tokens.TryRemove(token.Id, out t);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Allocates a new wait token
        /// </summary>
        /// <returns></returns>
        public WaitToken AllocateToken()
        {
            var token = new WaitToken(Interlocked.Increment(ref nextId));

            return tokens.AddOrUpdate(token.Id, token, (a, b) => { throw new Exception("Key should not already be present"); });
        }