最近,我将智能手机更新到了 Android 11,我注意到我的一个应用程序在创建外部存储目录时崩溃了。我已阅读 Android 11 文档,现在是Starting in Android 11, apps cannot create their own app-specific directory on external storage. 很奇怪,因为当我打开 Android/data 目录时,有很多应用程序文件夹,所以有可能这样做,或者可能有应用程序在更新之前创建的文件夹?
我读了很多关于多处理、线程的文章,但我仍然对简单的事情有疑问。我有2个功能。我想一个接一个地调用并移动一个(这个被调用的函数不能减慢我的速度)。
例子
def main():
print("my operations")
Thread(target=child(), args=()).start()
print("rest operations")
def child():
#here are some operations that takes 3 seconds
print("background operations")
Run Code Online (Sandbox Code Playgroud)
关键是子函数的操作不能减慢我的速度。我想调用该函数并继续。所以我想要这样的输出:
Run Code Online (Sandbox Code Playgroud)my operations rest operations background operations
但这样做Thread(target=child(), args=()).start()看起来像
Run Code Online (Sandbox Code Playgroud)my operations
#then call child function wait 3 seconds
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)background operations rest operations
有没有办法做我想做的事?