1. <legend id='IDTD1'><style id='IDTD1'><dir id='IDTD1'><q id='IDTD1'></q></dir></style></legend><tfoot id='IDTD1'></tfoot>

    2. <i id='IDTD1'><tr id='IDTD1'><dt id='IDTD1'><q id='IDTD1'><span id='IDTD1'><b id='IDTD1'><form id='IDTD1'><ins id='IDTD1'></ins><ul id='IDTD1'></ul><sub id='IDTD1'></sub></form><legend id='IDTD1'></legend><bdo id='IDTD1'><pre id='IDTD1'><center id='IDTD1'></center></pre></bdo></b><th id='IDTD1'></th></span></q></dt></tr></i><div id='IDTD1'><tfoot id='IDTD1'></tfoot><dl id='IDTD1'><fieldset id='IDTD1'></fieldset></dl></div>

      • <bdo id='IDTD1'></bdo><ul id='IDTD1'></ul>

        <small id='IDTD1'></small><noframes id='IDTD1'>

        向 Python 中的所有线程发送单向消息

        Send one-way message to all threads in Python(向 Python 中的所有线程发送单向消息)
            <i id='kfYkY'><tr id='kfYkY'><dt id='kfYkY'><q id='kfYkY'><span id='kfYkY'><b id='kfYkY'><form id='kfYkY'><ins id='kfYkY'></ins><ul id='kfYkY'></ul><sub id='kfYkY'></sub></form><legend id='kfYkY'></legend><bdo id='kfYkY'><pre id='kfYkY'><center id='kfYkY'></center></pre></bdo></b><th id='kfYkY'></th></span></q></dt></tr></i><div id='kfYkY'><tfoot id='kfYkY'></tfoot><dl id='kfYkY'><fieldset id='kfYkY'></fieldset></dl></div>
            • <bdo id='kfYkY'></bdo><ul id='kfYkY'></ul>

                <tbody id='kfYkY'></tbody>

            • <tfoot id='kfYkY'></tfoot>

                <small id='kfYkY'></small><noframes id='kfYkY'>

                  <legend id='kfYkY'><style id='kfYkY'><dir id='kfYkY'><q id='kfYkY'></q></dir></style></legend>

                  本文介绍了向 Python 中的所有线程发送单向消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要向程序中运行的每个线程发送信息,并且每个线程都必须处理该信息.

                  I need to send information to every thread that's running in my program, and every thread has to process that information.

                  我不能使用常规队列来做到这一点,因为一旦一个线程从队列中删除数据,所有其他线程将无法再看到它.

                  I can't do it using a regular queue, because that way once one thread removes the data from the queue all the other threads won't be able to see it anymore.

                  实现这一目标的最佳方法是什么?

                  What's the best way of achieving this?

                  推荐答案

                  一种方法是为每个线程设置一个队列,广播信息的函数负责将消息插入到每个线程的队列.

                  One way is to have a queue for each thread, and the function that broadcasts the information is responsible for inserting the message into the queue of every thread.

                  例如,这类似于消息队列在 Windows 中的工作方式.每个执行 GUI 操作的线程都有一个关联的消息队列,独立于任何其他线程.

                  This is similar to the way message queues work in Windows, for example. Each thread that does GUI operations has an associated message queue, independent from that of any other thread.

                  这篇关于向 Python 中的所有线程发送单向消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding config modes to Plotly.Py offline - modebar(将配置模式添加到 Plotly.Py 离线 - 模式栏)
                  Plotly: How to style a plotly figure so that it doesn#39;t display gaps for missing dates?(Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙?)
                  python save plotly plot to local file and insert into html(python将绘图保存到本地文件并插入到html中)
                  Plotly: What color cycle does plotly express follow?(情节:情节表达遵循什么颜色循环?)
                  How to save plotly express plot into a html or static image file?(如何将情节表达图保存到 html 或静态图像文件中?)
                  Plotly: How to make a line plot from a pandas dataframe with a long or wide format?(Plotly:如何使用长格式或宽格式的 pandas 数据框制作线图?)
                  <legend id='xOfuI'><style id='xOfuI'><dir id='xOfuI'><q id='xOfuI'></q></dir></style></legend>
                  <tfoot id='xOfuI'></tfoot>
                      <tbody id='xOfuI'></tbody>
                  • <i id='xOfuI'><tr id='xOfuI'><dt id='xOfuI'><q id='xOfuI'><span id='xOfuI'><b id='xOfuI'><form id='xOfuI'><ins id='xOfuI'></ins><ul id='xOfuI'></ul><sub id='xOfuI'></sub></form><legend id='xOfuI'></legend><bdo id='xOfuI'><pre id='xOfuI'><center id='xOfuI'></center></pre></bdo></b><th id='xOfuI'></th></span></q></dt></tr></i><div id='xOfuI'><tfoot id='xOfuI'></tfoot><dl id='xOfuI'><fieldset id='xOfuI'></fieldset></dl></div>
                      • <bdo id='xOfuI'></bdo><ul id='xOfuI'></ul>

                            <small id='xOfuI'></small><noframes id='xOfuI'>