コード例 #1
0
ファイル: Thread.cs プロジェクト: top501/DVTK-1
        /// <summary>
        /// Code that normally would be present in the constructor.
        /// This code is however put in a separate method to be able to have only
        /// one constructor in DicomThread. This way, it is easier to derive from a
        /// DicomThread class.
        ///
        /// Use this method if this threads should not have a parent thread.
        /// </summary>
        /// <param name="threadManager">The ThreadManager that manages this object.</param>
        protected void Initialize(ThreadManager threadManager)
        {
            this.parent           = null;
            this.dotNetThread     = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadEntryPoint));
            this.threadManager    = threadManager;
            this.commonThreadLock = this.threadManager.CommonThreadLock;
            this.childs           = new ThreadCollection(this.commonThreadLock);
            this.topmostThread    = this;

            lock (this.commonThreadLock)
            {
                this.threadManager.Childs.Add(this);
                this.threadManager.Threads.Add(this);
            }
        }
コード例 #2
0
ファイル: Thread.cs プロジェクト: top501/DVTK-1
        //
        // - Methods -
        //

        /// <summary>
        /// Code that normally would be present in the constructor.
        /// This code is however put in a separate method to be able to have only
        /// one constructor in DicomThread. This way, it is easier to derive from a
        /// DicomThread class.
        ///
        /// Use this method if this object should have a parent thread.
        /// </summary>
        /// <param name="parent">The parent Thread.</param>
        protected void Initialize(Thread parent)
        {
            this.parent           = parent;
            this.dotNetThread     = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadEntryPoint));
            this.threadManager    = this.parent.ThreadManager;
            this.commonThreadLock = this.threadManager.CommonThreadLock;
            this.childs           = new ThreadCollection(this.commonThreadLock);
            this.topmostThread    = this.parent.TopmostThread;

            lock (this.commonThreadLock)
            {
                this.parent.childs.Add(this);
                this.parent.ThreadManager.Threads.Add(this);
            }

            if (this.parent.Options.AttachChildsToUserInterfaces)
            {
                foreach (UserInterface userInterface in this.parent.AttachedUserInterfaces)
                {
                    userInterface.Attach(this);
                }
            }
        }
コード例 #3
0
ファイル: ThreadManager.cs プロジェクト: ewcasas/DVTK
 public ThreadManager()
 {
     this.childs = new ThreadCollection(this.commonThreadLock);
     this.threads = new ThreadCollection(this.commonThreadLock);
 }
コード例 #4
0
ファイル: ThreadManager.cs プロジェクト: top501/DVTK-1
 public ThreadManager()
 {
     this.childs  = new ThreadCollection(this.commonThreadLock);
     this.threads = new ThreadCollection(this.commonThreadLock);
 }
コード例 #5
0
ファイル: Thread.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Code that normally would be present in the constructor.
        /// This code is however put in a separate method to be able to have only
        /// one constructor in DicomThread. This way, it is easier to derive from a
        /// DicomThread class.
        /// 
        /// Use this method if this threads should not have a parent thread.
        /// </summary>
        /// <param name="threadManager">The ThreadManager that manages this object.</param>
        protected void Initialize(ThreadManager threadManager)
        {
            this.parent = null;
            this.dotNetThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadEntryPoint));
            this.threadManager = threadManager;
            this.commonThreadLock = this.threadManager.CommonThreadLock;
            this.childs = new ThreadCollection(this.commonThreadLock);
            this.topmostThread = this;

            lock(this.commonThreadLock)
            {
                this.threadManager.Childs.Add(this);
                this.threadManager.Threads.Add(this);
            }
        }
コード例 #6
0
ファイル: Thread.cs プロジェクト: ewcasas/DVTK
        //
        // - Methods -
        //
        /// <summary>
        /// Code that normally would be present in the constructor.
        /// This code is however put in a separate method to be able to have only
        /// one constructor in DicomThread. This way, it is easier to derive from a
        /// DicomThread class.
        /// 
        /// Use this method if this object should have a parent thread.
        /// </summary>
        /// <param name="parent">The parent Thread.</param>
        protected void Initialize(Thread parent)
        {
            this.parent = parent;
            this.dotNetThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadEntryPoint));
            this.threadManager = this.parent.ThreadManager;
            this.commonThreadLock = this.threadManager.CommonThreadLock;
            this.childs = new ThreadCollection(this.commonThreadLock);
            this.topmostThread = this.parent.TopmostThread;

            lock(this.commonThreadLock)
            {
                this.parent.childs.Add(this);
                this.parent.ThreadManager.Threads.Add(this);
            }

            if (this.parent.Options.AttachChildsToUserInterfaces)
            {
                foreach(UserInterface userInterface in this.parent.AttachedUserInterfaces)
                {
                    userInterface.Attach(this);
                }
            }
        }