mardi 22 novembre 2016

Weird problems with variables and multiple threads

I have a program with multiple threads. In my main thread I examine in a permanent loop whether a global variable has the value 1. This variable I set during the runtime in the other thread with a Mutex locked on it to 1. So the if condition should be true in the main thread. But it doesn't work... But if i put a printf before the if condition it works. This is so weird I have no idea whats wrong. Thanks

Aucun commentaire:

Enregistrer un commentaire