Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - More on TCPIP: Page 1 of 7 (7 Items)
   
More on TCPIP  
Hello

So, this is the continuation of my old topics.

Currently I have changed my program like described below.

1) A thread puts several data blocks (A, B, C, D) into queue.
2) One or more other threads lock the serialization mutex, extract current queue content (if any), send data with 
sendmsg() (if any) and then unlock the serialization mutex.

So, since the data is pushed into queue by one thread the order of blocks in it is guarranteed to be "A, B, C, D". Since
 the thread that does the transmission extracts the data and executed sendmsg() inside of a mutex lock, it is 
guarranteed that data is delivered to the protocol stack in the same order it appears in queue. However today I have 
cought an assertion check that the data has arrived to client in swapped order: "B, C, D, A".

So, it is evident that there were at least two sendmsg() calls, first with "A" and second with "B, C, D". The first call
 exited and unlocked the mutex before second thread could lock the mutex and enter sendmsg(). Nevertheless the buffers 
were swapped inside of io-net.

Can I have a confirmation this scenario is possible? And more important, can I have the confirmation that even though 
the data of the sequential calls might be swapped, it can't be intermixed with each other, provided the access to 
sendmsg() is serialized as described above?