Workaround for MSVC2013's buggy atomic
This commit is contained in:
parent
fe818f8005
commit
bfc6744b03
2 changed files with 18 additions and 3 deletions
|
@ -115,7 +115,12 @@ void tloadscreen::progress(const char* stage)
|
|||
return;
|
||||
}
|
||||
if(stage) {
|
||||
current_load->current_stage_.store(stage, std::memory_order_release);
|
||||
current_load->current_stage_
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
= stage;
|
||||
#else
|
||||
.store(stage, std::memory_order_release);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,7 +131,12 @@ void tloadscreen::timer_callback(twindow& window)
|
|||
if (!worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) {
|
||||
window.close();
|
||||
}
|
||||
const char* stage = current_stage_.load(std::memory_order_acquire);
|
||||
const char* stage = current_stage_
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
;
|
||||
#else
|
||||
.load(std::memory_order_acquire);
|
||||
#endif
|
||||
if (stage && (current_visible_stage_ == stages.end() || stage != current_visible_stage_->first))
|
||||
{
|
||||
auto iter = stages.find(stage);
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
/**
|
||||
* Hides the window.
|
||||
*
|
||||
* The hiding also destroys the window. It is save to call the function
|
||||
* The hiding also destroys the window. It is safe to call the function
|
||||
* when the window is not shown.
|
||||
*/
|
||||
void close();
|
||||
|
@ -79,7 +79,12 @@ private:
|
|||
tlabel* animation_label_;
|
||||
static tloadscreen* current_load;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
// std::atomic is buggy in MSVC 2013 - doesn't work for cv types
|
||||
const char* current_stage_;
|
||||
#else
|
||||
std::atomic<const char*> current_stage_;
|
||||
#endif
|
||||
std::map<std::string,std::string>::const_iterator current_visible_stage_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue