QNX 6.1 (patch A)
I have a process which sets up a socket for TCP communication with other
nodes (non QNX) over ethernet. It then creates two threads one which is for
sending data over ethernet and one which is for receiving over ethernet. I
would like the send thread to do something like:
// SEND_THREAD
while(1)
{
receive(); // Block until another QNX process sends data to be
sent out over ethernet
reply();
send(); // Send data out over ethernet
}
The receive thread to do something like:
// RECEIVE_THREAD
while(1)
{
recv(); // Block until data is received from ethernet
send(); // Send data to QNX process
}
The other QNX process looks something like:
// QNX_PROCESS
while(1)
{
receive(); // Block until receive_thread sends data
process_data();
send() // Send data to send_thread
}
As I understand it 2-way communication between processes like this is not
allowed because if both send() at the same time then deadlock occurs. How
can I achieve this functionality without risking deadlock?
Can I create two communication channels between the processes?
Can I receive() instead of send() in the receive_thread (and consequently
swap receive() for send() in the qnx_process) and reply() with the data?
What happens if two threads in a process are receive() blocked and a message
is sent? Can they both examine the message and act appropriately?
Any help would be appreciated.
–
Paul.