Changeset 4d68584 in mainline
- Timestamp:
- 2019-07-02T10:59:39Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 09170ab8
- Parents:
- 239d25b
- Location:
- uspace/lib/cpp/include/__bits/thread
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/include/__bits/thread/packaged_task.hpp
r239d25b r4d68584 30 30 #define LIBCPP_BITS_THREAD_PACKAGED_TASK 31 31 32 #include <__bits/exception.hpp> 32 33 #include <__bits/functional/function.hpp> 33 34 #include <__bits/thread/future.hpp> … … 84 85 if (!state_->is_set()) 85 86 { 86 // TODO: store future_error 87 state_->set_exception(make_exception_ptr( 88 future_error{make_error_code(future_errc::broken_promise)} 89 )); 87 90 state_->mark_set(true); 88 91 } … … 162 165 state_->set_value(invoke(func_, args...)); 163 166 } 164 catch( ...)165 { 166 // TODO: store it167 catch(const exception& __exception) 168 { 169 state_->set_exception(make_exception_ptr(__exception)); 167 170 } 168 171 } -
uspace/lib/cpp/include/__bits/thread/promise.hpp
r239d25b r4d68584 30 30 #define LIBCPP_BITS_THREAD_PROMISE 31 31 32 #include <__bits/exception.hpp> 32 33 #include <__bits/thread/future.hpp> 33 34 #include <__bits/thread/shared_state.hpp> … … 94 95 } 95 96 96 void set_exception_at_thread_exit(exception_ptr) 97 { 98 // TODO: No exception handling, no-op at this time. 97 void set_exception_at_thread_exit(exception_ptr ptr) 98 { 99 assert(state_); 100 101 state_->set_exception_ptr(ptr, false); 102 // TODO: Mark it as 'has_exception' when thread terminates. 99 103 } 100 104 … … 117 121 if (!state_->is_set()) 118 122 { 119 // TODO: Store future_error. 123 state_->set_exception(make_exception_ptr( 124 future_error{make_error_code(future_errc::broken_promise)} 125 )); 120 126 state_->mark_set(true); 121 127 } -
uspace/lib/cpp/include/__bits/thread/shared_state.hpp
r239d25b r4d68584 76 76 } 77 77 78 void set_exception(exception_ptr ptr )78 void set_exception(exception_ptr ptr, bool set = true) 79 79 { 80 80 exception_ = ptr; 81 has_exception_ = true;81 has_exception_ = set; 82 82 } 83 83 … … 89 89 void throw_stored_exception() const 90 90 { 91 // TODO: implement 91 if (has_exception_) 92 rethrow_exception(exception_); 92 93 } 93 94 … … 266 267 } 267 268 } 268 catch( ...) // TODO: Any exception.269 catch(const exception& __exception) 269 270 { 270 // TODO: Store it.271 this->set_exception(make_exception_ptr(__exception)); 271 272 } 272 273 } … … 351 352 } 352 353 } 353 catch( ...)354 catch(const exception& __exception) 354 355 { 355 // TODO: Store it.356 this->set_exception(make_exception_ptr(__exception)); 356 357 } 357 358 }
Note:
See TracChangeset
for help on using the changeset viewer.