Instead of using an ugly loop hack that swallows break and continue, I have replaced it with a simple if statement.
Please comment and/or apply!
Instead of using an ugly loop hack that swallows break and continue, I have replaced it with a simple if statement.
Please comment and/or apply!
I like this; it uses the proper c++ idiom (RAII) which is more readable and potentially more robust.
Can you add testcase/unittest?
Done. Thanks.
ACK
It would be nice to test that Critical section code actually works by spawning threads and testing locks in the test suite.
I'm going to merge this early-- writing multithreaded unit tests would be spiffy, but second-best is to merge early and get lots of testing.