Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        //
        // - 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);
                }
            }
        }
Ejemplo n.º 3
0
 public ThreadManager()
 {
     this.childs = new ThreadCollection(this.commonThreadLock);
     this.threads = new ThreadCollection(this.commonThreadLock);
 }
Ejemplo n.º 4
0
 public ThreadManager()
 {
     this.childs  = new ThreadCollection(this.commonThreadLock);
     this.threads = new ThreadCollection(this.commonThreadLock);
 }
Ejemplo n.º 5
0
        /// <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);
            }
        }
Ejemplo n.º 6
0
        //
        // - 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);
                }
            }
        }