Package dtk :: Package ui :: Module thread_pool :: Class MissionThreadPool

Class MissionThreadPool

source code


A class of thread pool.

Instance Methods
 
__init__(self, concurrent_thread_num=5, clean_delay=0, clean_callback=None, exit_when_finish=False)
Initialise the thread pool.
source code
 
run(self)
The thread function.
source code
 
add_missions(self, missions)
Add missions to the thread pool.
source code
 
start_mission(self, mission)
Start a specific mission in the thread pool.
source code

Inherited from threading.Thread: __repr__, daemon, getName, ident, isAlive, isDaemon, is_alive, join, name, setDaemon, setName, start

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  FINISH_SIGNAL = "Finish"
Properties

Inherited from object: __class__

Method Details

__init__(self, concurrent_thread_num=5, clean_delay=0, clean_callback=None, exit_when_finish=False)
(Constructor)

source code 

Initialise the thread pool.

Parameters:
  • concurrent_thread_num - Max concurrent thread number.
  • clean_delay - The time between the finish of the thread and the invocation of thread clean up function.
  • clean_callback - The clean up function, which is invoked after the thread is finished.
  • exit_when_finish - Indicates whether the thread pool should be destroyed after all mission is finished. By default, it's False.
Overrides: object.__init__

run(self)

source code 

The thread function.

Overrides: threading.Thread.run

add_missions(self, missions)

source code 

Add missions to the thread pool.

Parameters:
  • missions - A list of mission which is of type class MissionThread.

start_mission(self, mission)

source code 

Start a specific mission in the thread pool.

Parameters:
  • mission - a mission which is of type class MissionThread.