Python线程,如何实现共享队列?

发布于 2025-01-27 04:43:49 字数 445 浏览 3 评论 0原文

我正在使用python模块“螺纹”来异步和以thread> threadlock.release() and thread> thread> threadlock.release()以排队方式运行一个任务。

这个问题我正在运行相同的python程序,例如4-5台计算机和正在运行的异步任务,可以更改对同一Google表文件以及Dropbox等上的其他一些文件,因此如果同时使用了2台或更多台计算机,则可能会导致问题,因为事情被覆盖。

我喜欢现在在每台计算机上本地运行的情况,但是我只需要一种方法来获取threadlock.release() and threadlock.release()即可与其他运行相同Python程序的计算机基本上是计算机之间的共享队列。我缺少的螺纹模块中可能有一个简单的修复程序吗?

I'm using the Python module "Threading" to run a task in my code asynchronously and in a queued manner with threadLock.release() and threadLock.release().

The issue IS that i am running the same python program on like 4-5 computers and the asynchronous task that is being run makes changes to the same google sheet file and also some other files on dropbox etc, so if 2 or more of the computers are being used at the same time, it can cause issues because things get overwritten.

I love how things are running now locally on each computer, but I just need a way to get the threadLock.release() and threadLock.release() to communicate with the other computers running the same python program, basically a shared queue between computers. Is there possibly a simple fix in the threading module that i am missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文