c++ - Cache Flushing issue in release build -



c++ - Cache Flushing issue in release build -

i seeing unusual problem in code:

namespace{ std::vector<int> my_vect; } thread1: sleep(5); my_vect.push_back(1); main_thread: while(my_vect.empty()); //do return;

when built in debug, works expected. when in release while loop never exits...

when changed while loop busy wait a:

while(my_vect.empty()) { sleep(1); }

the release built started working again.

any thought why happening?

yes: unsynchronized access shared variable undefined behavior, , may happen. observed behavior isn't particularly unusual.

c++ cpu

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -