[Qt-interest] Socket communication without threads

Predrag Manojlovic pedjaman at gmail.com
Mon Mar 2 17:08:37 CET 2009


Andreas Pakulat wrote:
> On 02.03.09 16:36:27, Predrag Manojlovic wrote:
>> Often i hear that threads should be avoided in qt socket applications.
>> I'm not sure is that possible always.
> 
> Of course its not _always_ possible, but most of the time it is.
> 
>> I'm mostly creating applications like TCP chat client/server.
>>
>> Questions:
>> 1. Is there any way to create chat server without using threads?
> 
> Can't answer that one.
> 
>> 2. why is that better?
> 
> In general using only 1 thread is better because you avoid all
> concurrent-access problems you get when having multiple threads. You don't
> need to make sure you're accessing data only from one thread at a time,
> debugging is a lot easier, you avoid a lot of possible timing issues
> because sometimes one thread runs "faster" than another and causes a
> problem.
> 
> Andreas
> 

Looks like only reason is concurrent access.
I was afraid that I missed something important in my experience :)

That answers to my questions :)
Thank you.



More information about the Qt-interest-old mailing list