I am able to remove this warning, please suggest on below points.
QSocketNotifier: socket notifiers cannot be enabled from another thread
Whenever new request comes to QTcpServer i create new object -- xxx
. This object then create thread for this socket & send receive data in
dowork_socket() function of yyy object. Inside dowork_socket() function i emit signal signalTcpSocketWriteData() to send data from socket.
Object creating the thread for new socket - xxx
(I am not pasting full code):----
yyy * ptr;
QTcpSocket *m_pTcpSocket;
public slots:
void writeDataSlot( QByteArray data )
{
m_pTcpSocket->write( data );
m_pTcpSocket->flush();
}
Object in which thread is moved -- yyy
(I am not pasting full code) :----
xxx *TcpSocketWrapper_ptr;
signals:
void signalTcpSocketWriteData( QByteArray);
public slots:
void dowork_socket();
Inside above object yyy contructor I am connecting signal signalTcpSocketWriteData to slot writeDataSlot :---
connect(this, SIGNAL(signalTcpSocketWriteData( QByteArray)), TcpSocketWrapper_ptr, SLOT(writeDataSlot( QByteArray )), Qt::QueuedConnection );
dowork function of object yyy :--
void TcpSocketThreadObject::dowork_socket()
{
QByteArray block;
block.append(" \n hi again .. !!!");
emit signalTcpSocketWriteData(block);
}
I am able to send data success fully by above method & above warning is removed.
1>
Now my question is suppose two threads are created & both thread simultaneously emit the signal then will there be conflict in running the slot ?
2>
Will it cause some critical section problem or events are queued & will not be executed simultaneously ?
Please suggest on this two points.