I can only tell you its function. It contains valid coordinates in the board to examine to place a queen. This is because I remove rows and columns as I place queens.
When I think about it, it might have been better to just merge BoardCoordinates and Board into a single class, but... well, right now, it works, so I don't want to go there. In the future, if I reuse this, I might do it.
Probably a bad name when you mention it...Neither does GetBoard (it gets a field).
Initially, I didn't use any function at all. I just indexed the board using the index operator directly. But then I wanted to test location and whether it could speed up the function (ie, x first or y first), so I made it into a lambda.- Why is GetBoard even a bound function? Why not make Board a proper class and give it an indexing call operator, so that you can write Board(x, y)? Boost.Bind can act as an optimization barrier (it holds a function pointer), and you definitely want the field access to be inlined.
But gcc 4.4 doesn't support lambdas, so I just used a dirty hack to make it compile.
I didn't want static division. One thread my run faster than another. So ideally, what I wanted to do is create n threads, wait until one of them finishes, schedule more work for it.- Given that your work queue is pretty much known at compile time, static work division by index would be far more efficient than the work queue: no locking, no fetching elements from a stack.
There is no WaitForMultipleObjects, so this is the best I figured I could do it.
If it's free, then it's definitely something I would consider in the future.- Whether you use a work queue or computed work division, a better choice as the basis of the implementation would be the Intel Threading Building Blocks (TBB) library. It has higher-level operations, such as a parallel for loop. You could model your problem very well with a parallel for loop, I think.
However, there are requirements on this task. It must use threads, condition variables and locks. No abstraction mechanisms such as OpenMP.