<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Thread optimization issue]]></title><description><![CDATA[<p dir="auto">Hi guys,<br />
i need help in deciding the correct way of managing threads.</p>
<p dir="auto">Problem description :<br />
I have a xml file containing some messages with id and a cycle time for each message.<br />
The cycle time tells at what rate the messages should keep sending. Here lets take the total<br />
number of messages as 100.<br />
my requirement is that, i will get notification from outside (lets take it as some programme<br />
triggering the message id)  every time i get the message with id from outside i need to search<br />
for that id in xml file and keep on sending the message  to some other class for every cycle time of that message. This can be handled by timer and keep one sending the message.</p>
<p dir="auto">but my problem is for every message am creating a new thread and sending which is not good.<br />
can some tell me some thread optimization here so that it can be easily handled in later stages also.</p>
<p dir="auto">XML File<br />
@<br />
&lt;id&gt;1&lt;/id&gt;<br />
&lt;msg&gt;hello&lt;/msg&gt;<br />
&lt;cycle&gt;1000&lt;/cycle&gt;</p>
<pre><code>         &lt;id&gt;2&lt;/id&gt;
  &lt;msg&gt;hello Qt&lt;/msg&gt;
         &lt;cycle&gt;1000&lt;/cycle&gt;
                .
                .
                .
</code></pre>
<p dir="auto">@</p>
<p dir="auto">@<br />
class xmlparser() -------&gt; reads xml file.<br />
class MessageSender() -------&gt; sends the message to class RecieverMessage.<br />
class RecieverMessage()  ----------&gt; getmessage(id) , recieves the message,<br />
searches the id in xmlparser and keep on creating thread and sends the message.<br />
@</p>
<p dir="auto">[andreyc EDIT]: Added @ around code.</p>
]]></description><link>https://forum.qt.io/topic/45794/thread-optimization-issue</link><generator>RSS for Node</generator><lastBuildDate>Thu, 18 Jun 2026 16:53:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/45794.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Sep 2014 10:12:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Thread optimization issue on Thu, 11 Sep 2014 03:21:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi ,</p>
<p dir="auto">Thank you for your reply Dheerendra and andreyc,</p>
<p dir="auto">I have inherited class from QThread and i need signal / slot communication.<br />
so what kind of optimization i can do in this case</p>
]]></description><link>https://forum.qt.io/post/243352</link><guid isPermaLink="true">https://forum.qt.io/post/243352</guid><dc:creator><![CDATA[RohitIti]]></dc:creator><pubDate>Thu, 11 Sep 2014 03:21:19 GMT</pubDate></item><item><title><![CDATA[Reply to Thread optimization issue on Wed, 10 Sep 2014 23:59:05 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Dheerendra" date="1410348149"]There is QThreadPool and which works with only QRunnable. This can be used only if you don't want any signal/slot communication with your thread objects.[/quote]</p>
<p dir="auto">It is not quite true.<br />
You can inherit your class from "QObject and QRunnable":<a href="http://qt-project.org/forums/viewthread/22030/#104010" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/forums/viewthread/22030/#104010</a> to get signal slot communication.</p>
]]></description><link>https://forum.qt.io/post/243346</link><guid isPermaLink="true">https://forum.qt.io/post/243346</guid><dc:creator><![CDATA[andreyc]]></dc:creator><pubDate>Wed, 10 Sep 2014 23:59:05 GMT</pubDate></item><item><title><![CDATA[Reply to Thread optimization issue on Wed, 10 Sep 2014 11:22:29 GMT]]></title><description><![CDATA[<p dir="auto">How are you creating thread ? Did you inherit from QThread or using QRunnable ? You need to some kind of ThreadPool to manage number of threads what you create.  There is QThreadPool and which works with only QRunnable. This can be used only if you don't want any signal/slot communication with your thread objects. Do you need to communicate back from threads to main UI ?</p>
]]></description><link>https://forum.qt.io/post/243256</link><guid isPermaLink="true">https://forum.qt.io/post/243256</guid><dc:creator><![CDATA[dheerendra]]></dc:creator><pubDate>Wed, 10 Sep 2014 11:22:29 GMT</pubDate></item></channel></rss>