Ignore:
Timestamp:
2019-07-02T14:00:28Z (6 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ab9df4
Parents:
d3ba97d
Message:

cpp: moved all the at_exit logic to two functions which are to be implemented later to avoid TODO duplication throughout the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/__bits/thread/packaged_task.hpp

    rd3ba97d r72786f38  
    179179            void make_ready_at_thread_exit(Args...)
    180180            {
    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_);
    182200            }
    183201
Note: See TracChangeset for help on using the changeset viewer.