I've searched a lot for an answer to this question, but it seems there isn't any.
I'm using Qt 5.2.0 to make a TCP client with winsocks2. The language in use is C++. To make the connection loop (where I call send() and write()) I'm using QThread (that can be read here http://qt-project.org/doc/qt-4.8/qthread.html), it's worked well so far, but I want to be sure that there is no context switching when my program is writing or reading something. So I've thought that critical sections would be the right way to do it, but in my searches on the Internet I haven't found any way to do it and even in the Qt official documentation there is no reference to critical section.
Then here is my question: Is there some way to use critical sections in Qt? Do I need put a mutex in the section I want avoid context switching and put mutexes in other places? If affirmative, in which parts should I put these mutexes?
I'm sorry for my English. Thanks in advance.
If there is something more that I can inform, please tell me.
Murilo G. K.