python - 将异步扭曲代码集成到同步 python 代码中

标签 python asynchronous concurrency twisted

如何让同步代码包含由 Twisted 实现的异步代码部分?该代码部分还需要多次调用,这会干扰 reactor.run() 事件循环。 我想要实现的是半同步/半异步模式。

最佳答案

对此有多种选择。可能你只想要 Crochet , 但 LVH 给出了 a PyCon talk on mixing Twisted together with various other systems ,包括其他异步框架和“普通”同步 Python 代码;您可能想观看它以了解您的选择。

关于python - 将异步扭曲代码集成到同步 python 代码中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34876656/

相关文章:

带有子进程返回的 Python 脚本必须是 str,而不是 int evrything linter 说是这种情况

node.js - 什么是阻塞函数?

node.js - 那么如何处理 if-else in promise 呢?

java - 当我在 CyclicBarrier 回调中调用 join 时,应用程序挂起

java - 新线程和调用线程都会被阻塞 Java Semaphore

python - 防止按组将 xaxis 中的字符串转换为 int

python - 用 Python 中的多个 plot.ly 图形绘制图

c# - 任务状态 :Waiting for activation -DownloadStringTaskAsync -WP8

java - 我的代码线程不安全吗?

python - Tensorflow 2.0 将keras模型转换为.pb文件