Jump to content
Posted 26 May 2012 - 09:59 AM
Posted 26 May 2012 - 11:22 AM
Edited by edd², 26 May 2012 - 11:27 AM.
Posted 26 May 2012 - 11:53 AM
Assuming you've ruled out things like TBB for good reason...
Posted 26 May 2012 - 12:38 PM
In case you didn't know, it appears Solaris 10 and later also has completion ports.
Posted 26 May 2012 - 01:21 PM
As for I/O completion port, i already use it for multiplexing network I/O. I also used a fix number of threads to manage those asynchronous I/O completions, for Windows of course (on Solaris, i'll probaly use /dev/poll). I want to use another threadpool mostly to process the requests (database queries, file lookup or transfer, etc) in order to avoid the I/O threads to block too long when a request takes too long to process.
The code will have to work on Solaris 10.
Edited by Antheus, 26 May 2012 - 01:22 PM.
Posted 26 May 2012 - 01:37 PM
Thread scheduler in asio went through several rewrites, so did other parts. It really is a hard problem, even when foremost experts in platforms and C++ come together.
Edited by Laval B, 26 May 2012 - 01:38 PM.
Posted 26 May 2012 - 04:15 PM
you'll need an atomic index to decide which queue to insert work in to next
Edited by Laval B, 26 May 2012 - 04:18 PM.
Posted 26 May 2012 - 04:26 PM
Edited by edd², 26 May 2012 - 04:27 PM.
Posted 26 May 2012 - 04:45 PM
If you do decide to do it this way, it might be worth checking that those intrinsics do indeed wrap to 0. I'm pretty sure they do, though.
_InterlockedIncrement wraps. The only problem is that all the atomic increment functions (at least on windows) work on signed integer types which wraps to a negative value.
Edited by Laval B, 26 May 2012 - 05:14 PM.