def _make_request_id_aware_start_new_thread(base_start_new_thread):
 def _start_new_thread(target, args, kw=None):
  if (kw is None):
   kw = {}
  request_id = remote_api_stub.RemoteStub._GetRequestId()
  request = request_state.get_request_state(request_id)
  def _run():
   try:
    remote_api_stub.RemoteStub._SetRequestId(request_id)
    request.start_thread()
    target(*args, **kw)
   finally:
    request_environment.current_request.Clear()
    request.end_thread()
  return base_start_new_thread(_run, ())
 return _start_new_thread

def _make_request_id_aware_start_new_thread ( base_start_new_thread ) : def _start_new_thread ( target , args , kw = None ) : if ( kw is None ) : kw = { } request_id = remote_api_stub . RemoteStub . _GetRequestId ( ) request = request_state . get_request_state ( request_id ) def _run ( ) : try : remote_api_stub . RemoteStub . _SetRequestId ( request_id ) request . start_thread ( ) target ( * args , ** kw ) finally : request_environment . current_request . Clear ( ) request . end_thread ( ) return base_start_new_thread ( _run , ( ) ) return _start_new_thread
returns a replacement for start_new_thread that inherits request id .