MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / set_exception

Method set_exception

imperative/python/src/graph_rt.h:112–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111
112 void set_exception(std::exception_ptr e) {
113 if (e) {
114 MGB_LOCK_GUARD(m_lock);
115 if (m_read_ahead >= 0) {
116 mgb_assert(m_read_ahead <= 1);
117 if (m_drop_next) {
118 m_drop_next = false;
119 } else {
120 m_promise.set_exception(e);
121 }
122 if (m_read_ahead == 1) {
123 m_promise = {};
124 }
125 --m_read_ahead;
126 } else {
127 mgb_assert(m_read_ahead == -1);
128 // TODO: maybe exception should be ignored
129 // if value was already set ?
130 m_promise.set_exception(e);
131 }
132 }
133 }
134};
135
136void init_graph_rt(pybind11::module m);

Callers 3

wrappedMethod · 0.45
def_rendezvousFunction · 0.45
init_tensorFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected