diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2019-07-18 12:03:12 +0200 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2020-03-25 18:44:04 -0400 |
commit | 3810145c1d8e21fc0819d71bbc42dcecced1f7e4 (patch) | |
tree | 6910b680b095e066c5028477b7eed23128d9ea91 /indra | |
parent | 72863b942829528a8a3af69d6e1e04a7ac139271 (diff) |
DRTVWR-476: Fix first round of compile errors.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llcond.h | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/indra/llcommon/llcond.h b/indra/llcommon/llcond.h index 8e7120582c..b4289528de 100644 --- a/indra/llcommon/llcond.h +++ b/indra/llcommon/llcond.h @@ -39,7 +39,7 @@ template <typename DATA> class LLCond { public: - typedef value_type DATA; + typedef DATA value_type; private: // This is the DATA controlled by the condition_variable. @@ -56,7 +56,7 @@ private: public: /// LLCond can be explicitly initialized with a specific value for mData if /// desired. - LLCond(value_type&& init=value_type()): + LLCond(const value_type& init=value_type()): mData(init) {} @@ -169,11 +169,16 @@ public: protected: // convert F32Milliseconds to a chrono::duration - std::chrono::milliseconds convert(F32Milliseconds duration) + auto convert(F32Milliseconds duration) { - // extract the F32 milliseconds from F32Milliseconds, construct - // std::chrono::milliseconds from that value - return { duration.value() }; + // std::chrono::milliseconds doesn't like to be constructed from a + // float (F32), rubbing our nose in the thought that + // std::chrono::duration::rep is probably integral. Therefore + // converting F32Milliseconds to std::chrono::milliseconds would lose + // precision. Use std::chrono::microseconds instead. Extract the F32 + // milliseconds from F32Milliseconds, scale to microseconds, construct + // std::chrono::microseconds from that value. + return std::chrono::microseconds{ std::chrono::microseconds::rep(duration.value() * 1000) }; } private: @@ -224,31 +229,31 @@ class LLScalarCond: public LLCond<DATA> using super = LLCond<DATA>; public: - using super::value_type; + using typename super::value_type; using super::get; using super::wait; using super::wait_for; /// LLScalarCond can be explicitly initialized with a specific value for /// mData if desired. - LLCond(value_type&& init=value_type()): + LLScalarCond(const value_type& init=value_type()): super(init) {} /// Pass set_one() a new value to which to update mData. set_one() will /// lock the mutex, update mData and then call notify_one() on the /// condition_variable. - void set_one(value_type&& value) + void set_one(const value_type& value) { - super::update_one([](value_type& data){ data = value; }); + super::update_one([&value](value_type& data){ data = value; }); } /// Pass set_all() a new value to which to update mData. set_all() will /// lock the mutex, update mData and then call notify_all() on the /// condition_variable. - void set_all(value_type&& value) + void set_all(const value_type& value) { - super::update_all([](value_type& data){ data = value; }); + super::update_all([&value](value_type& data){ data = value; }); } /** @@ -338,7 +343,7 @@ class LLOneShotCond: public LLBoolCond using super = LLBoolCond; public: - using super::value_type; + using typename super::value_type; using super::get; using super::wait; using super::wait_for; |