[Mesa-dev] [PATCH 1/2] clover: Catch errors from executing event action
Jan Vesely
jan.vesely at rutgers.edu
Tue Jul 17 22:29:49 UTC 2018
On Tue, 2018-07-17 at 14:17 -0700, Francisco Jerez wrote:
> Jan Vesely <jan.vesely at rutgers.edu> writes:
>
> > Abort all dependent events.
> > Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> > ---
> > src/gallium/state_trackers/clover/core/event.cpp | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/core/event.cpp b/src/gallium/state_trackers/clover/core/event.cpp
> > index cd5d786604..ed2b6ebdb8 100644
> > --- a/src/gallium/state_trackers/clover/core/event.cpp
> > +++ b/src/gallium/state_trackers/clover/core/event.cpp
> > @@ -51,7 +51,12 @@ event::trigger_self() {
> > void
> > event::trigger() {
> > if (wait_count() == 1)
> > - action_ok(*this);
> > + try {
> > + action_ok(*this);
> > + } catch (error &e) {
> > + for (event &ev : abort_self(e.get()))
> > + ev.abort(e.get());
> > + }
> >
>
> Any reason not to do it like:
>
> > try {
> > if (wait_count() == 1)
> > action_ok(*this);
> > } catch (error &e) {
> > abort(e.get());
> > }
>
> That seems slightly simpler and it should make sure that the abort
> action of the failing event is executed as well.
sure. It wasn't clear to me if it's ok to execute both action_ok and
action_fail for the same event. My understanding was that exactly one
of them is called.
I can even do:
void
-event::trigger() {
+event::trigger() try {
if (wait_count() == 1)
action_ok(*this);
for (event &ev : trigger_self())
ev.trigger();
+} catch (error &e) {
+ abort(e.get())
}
Jan
>
> Thanks.
>
> > for (event &ev : trigger_self())
> > ev.trigger();
> > --
> > 2.16.4
--
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180717/290e116b/attachment.sig>
More information about the mesa-dev
mailing list