threadgroup

class oslo_service.threadgroup.Thread(thread, group, link=True)

Bases: object

Wrapper around a greenthread.

Holds a reference to the ThreadGroup. The Thread will notify the ThreadGroup when it has done so it can be removed from the threads list.

cancel(*throw_args)
ident
stop()
wait()
class oslo_service.threadgroup.ThreadGroup(thread_pool_size=10)

Bases: object

The point of the ThreadGroup class is to:

  • keep track of timers and greenthreads (making it easier to stop them when need be).
  • provide an easy API to add timers.
add_dynamic_timer(callback, initial_delay=None, periodic_interval_max=None, *args, **kwargs)
add_thread(callback, *args, **kwargs)
add_timer(interval, callback, initial_delay=None, *args, **kwargs)
cancel(*throw_args, **kwargs)
stop(graceful=False)

stop function has the option of graceful=True/False.

  • In case of graceful=True, wait for all threads to be finished. Never kill threads.
  • In case of graceful=False, kill threads immediately.
stop_timers()
thread_done(thread)
timer_done(timer)
wait()

Previous topic

systemd

Next topic

CHANGES

Project Source

This Page