Hard to explain in english : when CPU was an issue, we often tried to avoid explicit checkings, trying to rely on the inner safety of the code, "the way it should work", which was of course hard to obtain in complex codes, where everything was not always working as it was supposed to...Not sure exactly what you mean there. What checking is there in C++ that you wouldn't have in a C program?
I like the Prog::WakeUp(){ cv.notify_one(); } thing.
Very convenient and more readable, thx, I take it !
At the inverse, I think that the "ThreadSafeCall" trick kills the lisibility when it comes to call the Print function...
More than that, in my real project, I don't want to block the whole function with the mutex, because I will run many instances of this function in parallel.
So if they all blocked the shared data, it won't be parallel anymore
About notify_all(), I agree with you that it sounds like it should satisfy my needs, but I tried to use it many times without any success.
Yes that's what I thought too. I tried with 1 single mutex, trying to block every threads at once, and releasing them with a notify_all, but without success. I do not see why.Originally I thought each thread was suppose to share a mutex so each thread knew when things were locked
Maybe Chili will have an idea if he comes around ? Or someone else on this forum ?
I found something great : the VS debugger is very good at MT : you can swap from one thread to another quite freely. Very convenient.
Anyway, thx for your help, man !