Skip to content

Commit 84d72d7

Browse files
authored
Merge pull request KhronosGroup#925 from gmlueck/gmlueck/async-error-priorities
Clarify async error handling priorities
2 parents f699273 + 56f1312 commit 84d72d7

File tree

1 file changed

+22
-28
lines changed

1 file changed

+22
-28
lines changed

adoc/chapters/programming_interface.adoc

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17444,10 +17444,9 @@ The queue and context classes can optionally take an asynchronous handler object
1744417444
<<async-handler>> on construction, which is a callable such as a function class
1744517445
or lambda, with an [code]#exception_list# as a parameter.
1744617446
Invocation of an <<async-handler>> may be triggered by the queue member
17447-
functions [code]#queue::wait_and_throw()# or
17448-
[code]#queue::throw_asynchronous()#, by the event member function
17449-
[api]#event::wait_and_throw#, or automatically on destruction of a queue or
17450-
context that contains unconsumed asynchronous errors.
17447+
functions [api]#queue::wait_and_throw# or [api]#queue::throw_asynchronous#, by
17448+
the event member function [api]#event::wait_and_throw#, or automatically on
17449+
destruction of a queue or context that contains unconsumed asynchronous errors.
1745117450
When invoked, an <<async-handler>> is called and receives an
1745217451
[code]#exception_list# argument containing a list of exception objects
1745317452
representing any unconsumed <<async-error,asynchronous errors>> associated with
@@ -17477,30 +17476,25 @@ when possible, and must then invoke [code]#std::terminate# or equivalent.
1747717476
[[subsubsec:async.handler.priorities]]
1747817477
==== Priorities of async handlers
1747917478

17480-
If the SYCL runtime can associate an <<async-error>> with a specific queue,
17481-
then:
17482-
17483-
* If the queue was constructed with an <<async-handler>>, that handler is
17484-
invoked to handle the error.
17485-
* Otherwise if the context enclosed by the queue was constructed with an
17486-
<<async-handler>>, that handler is invoked to handle the error.
17487-
* Otherwise when no handler was passed to either queue or context on
17488-
construction, then a default handler is invoked to handle the error, as
17489-
described by <<subsubsec:exception.nohandler>>.
17490-
* All handler invocations in this list occur at times as defined by
17491-
<<subsubsec:exception.async>>.
17492-
17493-
If the SYCL runtime cannot associate an <<async-error>> with a specific queue,
17494-
then:
17495-
17496-
* If the context in which the error occurred was constructed with an
17497-
<<async-handler>>, then that handler is invoked to handle the error.
17498-
* Otherwise when no handler was passed to the associated context on
17499-
construction, then a default handler is invoked to handle the error, as
17500-
described by <<subsubsec:exception.nohandler>>.
17501-
* All handler invocations in this list occur at times as defined by
17502-
<<subsubsec:exception.async>>.
17503-
17479+
If the async error is reported from a call to [api]#queue::wait_and_throw#,
17480+
[api]#queue::throw_asynchronous#, or from the queue destructor, the async error
17481+
is reported as follows:
17482+
17483+
* If the queue was constructed with an <<async-handler>>, that handler is
17484+
invoked to handle the error.
17485+
* Otherwise if the context enclosed by the queue was constructed with an
17486+
<<async-handler>>, that handler is invoked to handle the error.
17487+
* Otherwise, the default handler is invoked to handle the error as described in
17488+
<<subsubsec:exception.nohandler>>.
17489+
17490+
If the async error is reported from a call to [api]#event::wait_and_throw# and
17491+
if the event was created from a queue that has not yet been destroyed, the async
17492+
error is reported using the rules above for that queue.
17493+
17494+
Otherwise, the async error is reported from a call to
17495+
[api]#event::wait_and_throw# and the event was created from a queue that has
17496+
since been destroyed.
17497+
The behavior is undefined in this case.
1750417498

1750517499
==== Asynchronous errors with a secondary queue
1750617500

0 commit comments

Comments
 (0)