Changeset 8e24583 in mainline for uspace/lib/cpp/include/__bits/thread/shared_state.hpp
- Timestamp:
- 2019-07-03T16:59:49Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46c66f8
- Parents:
- 96fec16
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/thread/shared_state.hpp
r96fec16 r8e24583 115 115 wait_for(const chrono::duration<Rep, Period>& rel_time) 116 116 { 117 if (value_set_) 118 return future_status::ready; 119 117 120 aux::threading::mutex::lock(mutex_); 118 121 auto res = timed_wait_( … … 128 131 wait_until(const chrono::time_point<Clock, Duration>& abs_time) 129 132 { 133 if (value_set_) 134 return future_status::ready; 135 130 136 aux::threading::mutex::lock(mutex_); 131 137 auto res = timed_wait_( … … 189 195 aux::threading::mutex::unlock(mutex_); 190 196 191 aux::threading::condvar::broadcast(condvar_); 197 if (set) 198 aux::threading::condvar::broadcast(condvar_); 192 199 } 193 200 … … 199 206 aux::threading::mutex::unlock(mutex_); 200 207 201 aux::threading::condvar::broadcast(condvar_); 208 if (set) 209 aux::threading::condvar::broadcast(condvar_); 202 210 } 203 211 … … 293 301 294 302 protected: 295 future_status timed_wait_(aux::time_unit_t ) override303 future_status timed_wait_(aux::time_unit_t time) override 296 304 { 297 305 /** … … 299 307 * behaviour should be compliant. 300 308 */ 301 return future_status::timeout; 309 aux::threading::time::sleep(time); 310 if (this->value_set_) 311 return future_status::ready; 312 else 313 return future_status::timeout; 302 314 } 303 315
Note:
See TracChangeset
for help on using the changeset viewer.