Mono.Debugger.Backend.ThreadDB.GetThreadInfo C# (CSharp) Method

GetThreadInfo() public method

public GetThreadInfo ( TargetMemoryAccess target, GetThreadInfoFunc func ) : void
target TargetMemoryAccess
func GetThreadInfoFunc
return void
        public void GetThreadInfo(TargetMemoryAccess target, GetThreadInfoFunc func)
        {
            try {
                mutex.Lock ();
                this.target = target;
                mono_debugger_thread_db_iterate_over_threads (
                    handle, delegate (IntPtr th) {
                        long tid, tls, lwp;
                        if (!mono_debugger_thread_db_get_thread_info (
                                th, out tid, out tls, out lwp))
                            return false;

                        func ((int) lwp, tid);
                        return true;
                    });
            } finally {
                this.target = null;
                mutex.Unlock ();
            }
        }

Usage Example

示例#1
0
        internal void InitializeThreads(Inferior inferior, bool resume_threads)
        {
            if (thread_db != null)
                return;

            thread_db = ThreadDB.Create (this, inferior);
            if (thread_db == null) {
                if (!IsManaged)
                    return;

                Report.Error ("Failed to initialize thread_db on {0}", start.CommandLine);
                throw new TargetException (TargetError.CannotStartTarget,
                               "Failed to initialize thread_db on {0}", start.CommandLine);
            }

            int[] threads = inferior.GetThreads ();
            foreach (int thread in threads) {
                if (thread_hash.Contains (thread))
                    continue;
                ThreadCreated (inferior, thread, Inferior.HasThreadEvents, resume_threads);
            }

            thread_db.GetThreadInfo (inferior, delegate (int lwp, long tid) {
                SingleSteppingEngine engine = (SingleSteppingEngine) thread_hash [lwp];
                if (engine == null) {
                    Report.Error ("Unknown thread {0} in {1}", lwp, start.CommandLine);
                    return;
                }
                engine.SetTID (tid);
            });
        }