Changeset 72786f38 in mainline
- Timestamp:
- 2019-07-02T14:00:28Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5ab9df4
- Parents:
- d3ba97d
- Location:
- uspace/lib/cpp/include/__bits/thread
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/thread/packaged_task.hpp
rd3ba97d r72786f38 179 179 void make_ready_at_thread_exit(Args...) 180 180 { 181 // TODO: implement 181 if (!state_) 182 throw future_error{make_error_code(future_errc::no_state)}; 183 if (state_->is_set()) 184 { 185 throw future_error{ 186 make_error_code(future_errc::promise_already_satisfied) 187 }; 188 } 189 190 try 191 { 192 state_->set_value(invoke(func_, args...), false); 193 } 194 catch(const exception& __exception) 195 { 196 state_->set_exception(make_exception_ptr(__exception), false); 197 } 198 199 aux::set_state_value_at_thread_exit(state_); 182 200 } 183 201 -
uspace/lib/cpp/include/__bits/thread/promise.hpp
rd3ba97d r72786f38 106 106 107 107 state_->set_exception_ptr(ptr, false); 108 // TODO: Mark it as 'has_exception' when thread terminates.108 aux::set_state_exception_at_thread_exit(state_); 109 109 } 110 110 … … 226 226 227 227 this->state_->set_value(val, false); 228 // TODO: schedule it to be set as ready when thread exits228 aux::set_state_value_at_thread_exit(state_); 229 229 } 230 230 … … 241 241 242 242 this->state_->set_value(forward<R>(val), false); 243 // TODO: schedule it to be set as ready when thread exits243 aux::set_state_value_at_thread_exit(state_); 244 244 } 245 245 }; … … 312 312 313 313 this->state_->set_value(&val, false); 314 // TODO: schedule it to be set as ready when thread exits314 aux::set_state_value_at_thread_exit(state_); 315 315 } 316 316 }; -
uspace/lib/cpp/include/__bits/thread/shared_state.hpp
rd3ba97d r72786f38 371 371 } 372 372 }; 373 374 /** 375 * Note: The following two functions should: 376 * 1) Increment refcount. 377 * 2) Store ptr to a vector of shared_state_base ptrs 378 * (as those have ::mark_set member functions). 379 * 3) If not done already, register a function 380 * executing all these in the thread_atexit function 381 * once that is implemented. 382 */ 383 384 template<class R> 385 void set_state_value_at_thread_exit(shared_state<R>* state) 386 { 387 // TODO: implement 388 } 389 390 template<class R> 391 void set_state_exception_at_thread_exit(shared_state<R>* state) 392 { 393 // TODO: implement 394 } 373 395 } 374 396
Note:
See TracChangeset
for help on using the changeset viewer.