sks
sks

Reputation: 934

C++ thread network priorities

Is there any way to set a specific std::thread's network usage priority levels? E.g. I have multiple threads downloading information, but not all of them should have the same network usage, as I want some of the threads to download specific information faster.

Upvotes: 0

Views: 245

Answers (2)

user207421
user207421

Reputation: 310936

You could set the respective socket receive buffer sizes according to the priority, making sure that only the highest-priority ones have a socket buffer >= the bandwidth-delay product.

Upvotes: 1

Anders Abel
Anders Abel

Reputation: 69260

That's not a threading issue and should not be dealt with a the thread level. Instead, you should somehow specify when initiating each download how prioritized it is. How to do that depends entirely on how you are doing the downloads and what (if any) quality of service services you have available in the network.

Upvotes: 3

Related Questions