How can we open a new console to do another thing at the same time? (multi-thread programming) Ans: use “subprocess“
'''open new file in Host consol'''
log = open("myLogFile.log", "w")
'''Create a subprocess to do "adb logcat" and let stdout send to "log"'''
ret = subprocess.Popen("adb logcat -v threadtime -b all", creationflags =subprocess.CREATE_NEW_CONSOLE, stdout=log)
This article will distinguish Synchronous and Asynchronous. I just want to say forget your Chinese ……
API and callback
While the API receiving the callback remains on the stack, you would expect that the callback had been invoked on each element.
in the same thread
Callback is invoked after a function returns, or at least on another thread’s stack. while the API receiving the callback remains on the stack, the callback may not have been called, since it’s waiting for the connection to complete.
Therefore, if you want to design asynchronous APIs, keep your threads safety.