Exemple #1
0
        internal ThreadGroupReference GetMirrorOf(ThreadGroupId threadGroup)
        {
            if (threadGroup == default(ThreadGroupId))
            {
                return(null);
            }

            return(new ThreadGroupReference(this, threadGroup));
        }
Exemple #2
0
 internal ThreadGroupReference(VirtualMachine virtualMachine, ThreadGroupId threadGroupId)
     : base(virtualMachine, threadGroupId, null)
 {
     Contract.Requires(virtualMachine != null);
 }
 internal ThreadGroupReference(VirtualMachine virtualMachine, ThreadGroupId threadGroupId)
     : base(virtualMachine, threadGroupId, null)
 {
     Contract.Requires(virtualMachine != null);
 }
 public Error GetThreadGroupChildren(out ThreadId[] childThreads, out ThreadGroupId[] childGroups, ThreadGroupId group)
 {
     throw new NotImplementedException();
 }
 public Error GetTopLevelThreadGroups(out ThreadGroupId[] groups)
 {
     throw new NotImplementedException();
 }
 public Error GetThreadGroupName(out string groupName, ThreadGroupId group)
 {
     throw new NotImplementedException();
 }
 public Error GetThreadGroupParent(out ThreadGroupId parentGroup, ThreadGroupId group)
 {
     throw new NotImplementedException();
 }
 public Error GetThreadGroup(out ThreadGroupId threadGroup, ThreadId thread)
 {
     throw new NotImplementedException();
 }
        public Error GetTopLevelThreadGroups(out ThreadGroupId[] groups)
        {
            groups = null;

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            error = environment.GetTopThreadGroups(nativeEnvironment, out groups);
            return GetStandardError(error);
        }
        public Error GetThreadGroup(ThreadId threadId, out ThreadGroupId threadGroup)
        {
            threadGroup = default(ThreadGroupId);

            JniEnvironment nativeEnvironment;
            JvmtiEnvironment environment;
            jvmtiError error = GetEnvironment(out environment, out nativeEnvironment);
            if (error != jvmtiError.None)
                return GetStandardError(error);

            using (var thread = VirtualMachine.GetLocalReferenceForThread(nativeEnvironment, threadId))
            {
                if (!thread.IsAlive)
                    return Error.InvalidThread;

                jvmtiThreadInfo threadInfo;
                error = environment.GetThreadInfo(thread.Value, out threadInfo);
                if (error != jvmtiError.None)
                    return GetStandardError(error);

                threadGroup = (ThreadGroupId)VirtualMachine.TrackLocalObjectReference(threadInfo._threadGroup, environment, nativeEnvironment, true);
                nativeEnvironment.DeleteLocalReference(threadInfo._contextClassLoader);
                environment.Deallocate(threadInfo._name);
                return Error.None;
            }
        }
Exemple #11
0
        internal ThreadGroupReference GetMirrorOf(ThreadGroupId threadGroup)
        {
            if (threadGroup == default(ThreadGroupId))
                return null;

            return new ThreadGroupReference(this, threadGroup);
        }
Exemple #12
0
        public jvmtiError GetTopThreadGroups(JniEnvironment nativeEnvironment, out ThreadGroupId[] threadGroups)
        {
            threadGroups = null;

            int threadsGroupsCount;
            IntPtr threadsGroupsPtr;
            jvmtiError error = RawInterface.GetTopThreadGroups(this, out threadsGroupsCount, out threadsGroupsPtr);
            if (error != jvmtiError.None)
                return error;

            try
            {
                List<ThreadGroupId> threadGroupList = new List<ThreadGroupId>();
                unsafe
                {
                    jthreadGroup* threadGroupHandles = (jthreadGroup*)threadsGroupsPtr;
                    for (int i = 0; i < threadsGroupsCount; i++)
                    {
                        if (threadGroupHandles[i] == jthreadGroup.Null)
                            continue;

                        threadGroupList.Add((ThreadGroupId)VirtualMachine.TrackLocalObjectReference(threadGroupHandles[i], this, nativeEnvironment, true));
                    }
                }

                threadGroups = threadGroupList.ToArray();
                return jvmtiError.None;
            }
            finally
            {
                Deallocate(threadsGroupsPtr);
            }
        }