Reputation: 66965
I have two threads, each with a buffer with some data. I have a function that writes to a TCP socket. (I use ffmpeg for it.) How will the data packets arrive at the server — in some crazy mixed up way, or in some other order, or will the OS (Windows, in my case) make one thread wait until the other has finished?
Upvotes: 1
Views: 398
Reputation: 1271
mmm, well, you have to synchronize them, to avoid unexpected results.
Upvotes: 0
Reputation: 106599
That depends entirely upon which implementation of "sockets" you are using. If your implementation is synchronized, you'll get the first thread's data, followed by the second thread's data (The second thread will block while the first sends). If your implementation is not synchronized, you'll get gibberish.
Upvotes: 5