No Peter Pan objects

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: Do not create something that lives forever and lose track of it. When creating objects that may linger indefinitely especially those who have their own resident thread always keep a refe...)
 
m (Reverted edits by Ebybymic (Talk); changed back to last version by AlexGee)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Do not create something that lives forever and lose track of it.
+
Do not create something that lives forever and lose track of it.
  
 
When creating objects that may linger indefinitely especially those who have their own resident thread always keep a reference. For purposes such as pausing a program's execution it is vital to have a handle to each object that may have a separate execution path.  
 
When creating objects that may linger indefinitely especially those who have their own resident thread always keep a reference. For purposes such as pausing a program's execution it is vital to have a handle to each object that may have a separate execution path.  
Line 6: Line 6:
  
 
*[[Chain_of_Responsibility|Chain of responsibility]] - Make each object responsible for passing thread control messages to any children it instantiated.  
 
*[[Chain_of_Responsibility|Chain of responsibility]] - Make each object responsible for passing thread control messages to any children it instantiated.  
*[[Sington]] - Create a thread registry, this will contain methods to construct a new thread for a client and maintain a list of threads that have been constructed. This way the registry can directly manage the execution state of threads.
+
*[[Singleton]] - Create a thread registry, this will contain methods to construct a new thread for a client and maintain a list of threads that have been constructed. This way the registry can directly manage the execution state of threads.

Latest revision as of 03:11, 25 November 2010

Do not create something that lives forever and lose track of it.

When creating objects that may linger indefinitely especially those who have their own resident thread always keep a reference. For purposes such as pausing a program's execution it is vital to have a handle to each object that may have a separate execution path.

Solutions

  • Chain of responsibility - Make each object responsible for passing thread control messages to any children it instantiated.
  • Singleton - Create a thread registry, this will contain methods to construct a new thread for a client and maintain a list of threads that have been constructed. This way the registry can directly manage the execution state of threads.
Personal tools