def start_thread_on_demand(func):
 @wraps(func)
 def od_wrapper(*args, **kwds):
  from w3af.core.controllers.output_manager import manager
  if manager.is_alive():
   return func(*args, **kwds)
  with OutputManager.start_lock:
   try:
    manager.start()
   except RuntimeError:
    pass
  return func(*args, **kwds)
 return od_wrapper

def start_thread_on_demand ( func ) : @ wraps ( func ) def od_wrapper ( * args , ** kwds ) : from w3af . core . controllers . output_manager import manager if manager . is_alive ( ) : return func ( * args , ** kwds ) with OutputManager . start_lock : try : manager . start ( ) except RuntimeError : pass return func ( * args , ** kwds ) return od_wrapper
given that the output manager has been migrated into a producer/consumer model .