|
385 | 385 | }
|
386 | 386 | \end{codeblock}
|
387 | 387 |
|
388 |
| -%%******************* |
389 |
| -%%*** No-shared-stop-state indicator nostopstate_t |
390 |
| -%%******************* |
391 |
| -%\rSec3[stopsource.nostopstate]{No-shared-stop-state indicator} |
392 |
| -% |
393 |
| -%% double check nullopt_t |
394 |
| -% |
395 |
| -%\indexlibrary{\idxcode{nostopstate_t}}% |
396 |
| -%\indexlibrary{\idxcode{nostopstate}}% |
397 |
| -%\begin{itemdecl} |
398 |
| -%struct nostopstate_t{@\seebelow@}; |
399 |
| -%inline constexpr nostopstate_t nostopstate(@\unspec@); |
400 |
| -%\end{itemdecl} |
401 |
| -% |
402 |
| -%\pnum |
403 |
| -%The struct \tcode{nostopstate_t} is an empty class type used as a unique type to indicate the state of |
404 |
| -%not containing a shared stop state for \tcode{stop_source} objects. |
405 |
| -%In particular, \tcode{stop_source} has a constructor with \tcode{nostopstate_t} as a single argument type; |
406 |
| -%this indicates that a \tcode{stop_source} object is constructed that has no shared stop state. |
407 |
| -% |
408 |
| -%\pnum |
409 |
| -%Type \tcode{nostopstate_t} does not have a default constructor or an initializer-list constructor, |
410 |
| -%and is not an aggregate. |
411 | 388 |
|
412 | 389 | %*******************
|
413 | 390 | %*** stop_source constructors
|
|
444 | 421 | stop_source(const stop_source& rhs) noexcept;
|
445 | 422 | \end{itemdecl}
|
446 | 423 | \begin{itemdescr}
|
447 |
| - %\pnum\effects If \tcode{rhs.stop_possible()} is \tcode{true}, |
448 |
| - % constructs a \tcode{stop_source} |
449 |
| - % that shares the ownership of the stop state with \tcode{rhs}. |
450 | 424 |
|
451 |
| - % TODO: It's possible that evaluating stop_requested() == rhs.stop_requested() |
452 |
| - % could return 'false' if another thread concurrently called request_stop(). |
453 |
| - % Is this a problem putting it in in a post-condition? |
454 | 425 | \pnum\postconditions \tcode{*this == rhs} is \tcode{true}.
|
455 | 426 | \begin{note} \tcode{*this} and \tcode{rhs} share the ownership of the
|
456 | 427 | same stop state, if any. \end{note}
|
|
541 | 512 | \begin{itemdescr}
|
542 | 513 | \pnum\returns \tcode{true} if \tcode{*this} has ownership of a stop state;
|
543 | 514 | otherwise, \tcode{false}.
|
544 |
| - % NOT NECESSARY: |
545 |
| - %The determination of the return values is performed atomically. |
546 |
| - %the stop source can be used to perform stop requests, executed atomically. |
547 |
| - %\begin{note} Returns \tcode{false} if the object was created with \tcode{nostopstate} |
548 |
| - % or the values were moved away. |
549 |
| - % \end{note} |
550 | 515 | \end{itemdescr}
|
551 | 516 |
|
552 | 517 | \indexlibrarymember{stop_requested}{stop_source}%
|
|
564 | 529 | bool request_stop() noexcept;
|
565 | 530 | \end{itemdecl}
|
566 | 531 | \begin{itemdescr}
|
567 |
| - %\pnum\requires \tcode{stop_possible() == true} |
568 |
| - %Hans: |
569 |
| - %Did we discuss whether interrupt() on an invalid (e.g. default constructed) stop/interrupt token should be a no-op, |
570 |
| - %rather than undefined? I would expect that to be convenient if we start passing stop_tokens around explicitly. |
571 |
| - %Presumably a lot of short-lived tasks don't care about stopping/interruption, but might be used in a context in which an |
572 |
| - %stop/interrupt token is expected. With the change, you could just pass a default-constructed one. |
573 | 532 |
|
574 | 533 | \pnum\effects If \tcode{*this} does not have ownership of a stop state, returns \tcode{false}.
|
575 | 534 | Otherwise, atomically determines whether the owned stop state has received a stop request,
|
|
736 | 695 | the destructor does not block\iref{defns.block} waiting for the return from
|
737 | 696 | the invocation of \tcode{callback}.
|
738 | 697 | Releases ownership of the stop state, if any.
|
739 |
| - |
740 |
| - %\tcode{callback} is destroyed. |
741 |
| - %% TODO: FIX WORDING HERE: |
742 |
| - %If \tcode{\~stop_callback()} is invoked |
743 |
| - %%during invocation of the callback and both run on the same thread. |
744 |
| - %while the invocation of \tcode{callback} |
745 |
| - %is active on the current thread then the destructor does not block waiting |
746 |
| - %for the return from \tcode{callback}. |
747 | 698 | \end{itemdescr}
|
748 | 699 |
|
749 | 700 | }%\color{insertcolor}
|
|
775 | 726 | class jthread;
|
776 | 727 |
|
777 | 728 | \end{codeblock}
|
778 |
| - %void swap(jthread& x, jthread& y) noexcept; |
779 | 729 | }%\color{insertcolor}
|
780 | 730 | \begin{codeblock}
|
781 | 731 | ...
|
|
867 | 817 | }
|
868 | 818 | \end{codeblock}
|
869 | 819 |
|
870 |
| -%%{\color{blue} |
871 |
| -%[{\itshape{}Editorial note:} {After the synopsis, copy the whole description from |
872 |
| -% [thread.thread.constr] til [thread.thread.algorithm] |
873 |
| -% using \tcode{jthread} instead of \tcode{thread} |
874 |
| -% and apply the \color{diffcolor}differences signaled}. ] |
875 |
| -%} |
876 |
| - |
877 | 820 |
|
878 | 821 | %*******************
|
879 | 822 | %*** jthread constructors
|
|
1557 | 1500 | In that case the functions return immediately,
|
1558 | 1501 | returning \tcode{false} if the predicate evaluates to \tcode{false}.
|
1559 | 1502 |
|
1560 |
| -% Hans Boehm: |
1561 |
| -%We then also need some statement for the waiting functions that if they return with an stopped/interrupted status, |
1562 |
| -% their synchronization behavior is as though they called stop_requested(). |
1563 |
| -%{\color{blue} |
1564 |
| -%[{\itshape{}Editorial note:} Because all signatures here in the effects clause call |
1565 |
| -% \tcode{stop_requested()}, we don't need wording |
1566 |
| -% that the calls synchronize with \tcode{interrupt()/request_stop()}. ] |
1567 |
| -%} |
1568 |
| - |
1569 | 1503 |
|
1570 |
| -%**** untimed wait_until (with pred) |
| 1504 | +%**** wait_until (with pred) |
1571 | 1505 | % return false if stoken.stop_requested():
|
1572 | 1506 |
|
1573 | 1507 | \begin{itemdecl}
|
|
1576 | 1510 | Predicate pred,
|
1577 | 1511 | stop_token stoken);
|
1578 | 1512 | \end{itemdecl}
|
1579 |
| -%{\color{blue} |
1580 |
| -%[{\itshape{}Editorial note:} {\color{diffcolor}This color signals differences to the corresponding \tcode{wait()} function without the stop token parameter.} ] |
1581 |
| -%} |
1582 | 1513 |
|
1583 | 1514 | \begin{itemdescr}
|
1584 |
| - |
1585 |
| -%{\color{diffcolor} |
1586 | 1515 | \pnum\effects Registers for the duration of this call \tcode{*this} to get notified on a stop request on \tcode{stoken}
|
1587 | 1516 | during this call and then equivalent to:
|
1588 | 1517 | \begin{codeblock}
|
|
1606 | 1535 |
|
1607 | 1536 | \pnum \throws
|
1608 | 1537 | Any exception thrown by \tcode{pred}.
|
1609 |
| - |
1610 |
| -%}%diffcolor |
1611 |
| - |
1612 | 1538 | \end{itemdescr}
|
1613 | 1539 |
|
1614 | 1540 |
|
|
1623 | 1549 | Predicate pred,
|
1624 | 1550 | stop_token stoken);
|
1625 | 1551 | \end{itemdecl}
|
1626 |
| -%{\color{blue} |
1627 |
| -%[{\itshape{}Editorial note:} {\color{diffcolor}This color signals differences to the corresponding \tcode{wait_until()} function without the stop token parameter.} ] |
1628 |
| -%} |
1629 | 1552 |
|
1630 | 1553 | \begin{itemdescr}
|
1631 | 1554 | \pnum\effects Registers for the duration of this call \tcode{*this} to get notified on a stop request on \tcode{stoken}
|
|
1661 | 1584 | Timeout-related exceptions \iref{thread.req.timing},
|
1662 | 1585 | or any exception thrown by \tcode{pred}.
|
1663 | 1586 |
|
1664 |
| -%{\color{diffcolor} |
1665 |
| -% \pnum\sync If the function returns with an stopped/interrupted status, |
1666 |
| -% their synchronization behavior is as though it called \tcode{stop_requested()}. |
1667 |
| -%}%diffcolor |
1668 | 1587 | \end{itemdescr}
|
1669 | 1588 |
|
1670 | 1589 |
|
|
1678 | 1597 | Predicate pred,
|
1679 | 1598 | stop_token stoken);
|
1680 | 1599 | \end{itemdecl}
|
1681 |
| -%{\color{blue} |
1682 |
| -%[{\itshape{}Editorial note:} {\color{diffcolor}This color signals differences to the corresponding \tcode{wait_for()} function without the stop token parameter.} ] |
1683 |
| -%} |
1684 | 1600 | \begin{itemdescr}
|
1685 | 1601 | \pnum \effects Equivalent to:
|
1686 | 1602 | \begin{codeblock}
|
|
1717 | 1633 | \tcode{<stop_token>}
|
1718 | 1634 |
|
1719 | 1635 |
|
1720 |
| -%[except.terminate]:1.13: |
1721 |
| -%when execution of the initial function of a thread exits via an exception (32.3.2.2), or |
1722 |
| - |
1723 |
| - |
1724 | 1636 | {\color{blue}
|
1725 | 1637 | In 17.12.3.4 Resumption [coroutine.handle.resumption]/1:
|
1726 | 1638 | }
|
|
1763 | 1675 | at the time it constructed the object.
|
1764 | 1676 |
|
1765 | 1677 |
|
1766 |
| -%32.6.9[futures.async]/3.1 |
1767 |
| -%If launch::async is set in policy, calls INVOKE(decay-copy(std::forward<F>(f)), decaycopy( |
1768 |
| -%std::forward<Args>(args))...) (20.14.3, 32.3.2.2) as if in a new thread of execution |
1769 |
| -%represented by a thread object with the calls to decay-copy being evaluated in the thread that |
1770 |
| -%called async. |
1771 |
| - |
1772 |
| - |
1773 |
| -%Additionally, in 32.3.2[thread.thread.class]/1, there is wording that a std::thread object uniquely represents a thread of execution. I don't know that the added [thread.jthread.class]/1 is enough when it says same functionality as thread. |
1774 |
| -% |
1775 |
| -% Do we need to say that a std::jthread object uniquely represents a thread of execution? |
1776 |
| -% |
1777 |
| -% Do we need to say anything about thread and jthread objects not simultaneously representing the same thread of execution? In other words, given a thread object and a jthread object, they should not represent the same thread of execution. Since there is no interface in either thread or jthread that would allow this, I am ok if the answer is no we don't need to say anything. |
1778 |
| - |
0 commit comments