public VBinderThreadState(Thread current)
 {
     Contract.Ensures(Owner == current);
     Capabilities = new CapabilityRef(current, 0, Globals.CapabilityManager.NullCapability);
     MessageQueue = new VBinderMessageBuffer(Capacity, current);
     this.Owner = current;
 }
        public int MapInCapability(Thread current, Capability cap)
        {
            int id;
            if (cap.parent == current)
            {
                id = cap.Uses.id;
                cap.Uses.InsertAfter(Capabilities);
            }
            else
            {
                id = NewCapAllocId();
                var cap_ref = new CapabilityRef(current, id, cap);
                cap_ref.InsertAfter(Capabilities);
            }

            return id;
        }