Opened 14 years ago

Closed 12 years ago

#2486 closed Bugs (fixed)

thread: no documented thread move support function

Reported by: vicente.botet@… Owned by: Anthony Williams
Milestone: Boost 1.38.0 Component: thread
Version: Boost 1.36.0 Severity: Problem
Keywords: Cc:

Description

The following move support functions are not docummented on the documentation.

#ifdef BOOST_HAS_RVALUE_REFS

template <class F> thread(F&& f); thread(thread&& other); thread& operator=(thread&& other); thread&& move();

#else #ifdef BOOST_NO_SFINAE #else

template <class F> explicit thread(F f,typename disable_if<boost::is_convertible<F&,detail::thread_move_t<F> >, dummy* >::type=0)

#endif

template <class F> explicit thread(detail::thread_move_t<F> f); thread(detail::thread_move_t<thread> x); thread& operator=(detail::thread_move_t<thread> x); operator detail::thread_move_t<thread>(); detail::thread_move_t<thread> move();

#endif

Even if the semantics of these functions could be induced for completud it will be good to add them to the reference documentation.

Change History (2)

comment:1 by viboes, 13 years ago

The following is extracted from the standard. Anthony, a little adaptation should be enough, isn'it?

template <class F, class ...Args> thread(F&& f, Args&&... args); Requires: F and each type Ti in Args shall be CopyConstructible if an lvalue and otherwise MoveConstructible. INVOKE(f, w1, w2, ..., wN) (20.7.2) shall be a valid expression for some values w1, w2, ..., wN, where N == sizeof...(Args). Effects: Constructs an object of type thread and executes INVOKE(f, t1, t2, ..., tN) in a new thread of execution, where t1, t2, ..., tN are the values in args.... Any return value from f is ignored. If f terminates with an uncaught exception, std::terminate() shall be called. Synchronization: The invocation of the constructor happens before the invocation of f. Postconditions: get_id() != id(). *this represents the newly started thread. Throws: std::system_error if unable to start the new thread. Error conditions: — resource_unavailable_try_again — the system lacked the necessary resources to create another thread, or the system-imposed limit on the number of threads in a process would be exceeded.

thread(thread&& x); Effects: Constructs an object of type thread from x, and sets x to a default constructed state. Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the start of construction. Throws: Nothing.

thread assignment thread& operator=(thread&& x); Effects: If joinable(), calls terminate(). Otherwise, assigns the state of x to *this and sets x to a default constructed state. Postconditions: x.get_id() == id() and get_id() returns the value of x.get_id() prior to the assignment. Throws: Nothing.

comment:2 by Anthony Williams, 12 years ago

Resolution: fixed
Status: newclosed

Added documentation for move constructor on trunk

Note: See TracTickets for help on using tickets.