def measure_link_vsize(output_file, args): """ Execute |args|, and measure the maximum virtual memory usage of the process, printing it to stdout when finished. """ # This needs to be a list in order for the callback to set the # variable properly with python-2's scoping rules. t = [None] def callback(proc): t[0] = threading.Thread(target=measure_vsize_threadfunc, args=(proc, output_file)) t[0].start() exitcode = expandlibs_exec.main(args, proc_callback=callback) # Wait for the background thread to finish. t[0].join() return exitcode
def wrap_linker(args): """ Execute |args| and pass resulting |proc| object to a second thread that will track the status of the started |proc|. """ # This needs to be a list in order for the callback to set the # variable properly with python-2's scoping rules. t = [None] def callback(proc): t[0] = threading.Thread(target=periodically_print_status, args=(proc,)) t[0].start() exitcode = expandlibs_exec.main(args, proc_callback=callback) # Wait for the background thread to finish. t[0].join() return exitcode
def wrap_linker(args): """ Execute |args| and pass resulting |proc| object to a second thread that will track the status of the started |proc|. """ # This needs to be a list in order for the callback to set the # variable properly with python-2's scoping rules. t = [None] def callback(proc): t[0] = threading.Thread(target=periodically_print_status, args=(proc, )) t[0].start() exitcode = expandlibs_exec.main(args, proc_callback=callback) # Wait for the background thread to finish. t[0].join() return exitcode