MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getCancelState

Method getCancelState

src/jrd/jrd.cpp:9229–9285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9227}
9228
9229ISC_STATUS thread_db::getCancelState(ISC_STATUS* secondary)
9230{
9231 // Test for asynchronous shutdown/cancellation requests.
9232 // But do that only if we're neither in the verb cleanup state
9233 // nor currently detaching, as these actions should never be interrupted.
9234 // Also don't break wait in LM if it is not safe.
9235
9236 if (tdbb_flags & (TDBB_verb_cleanup | TDBB_dfw_cleanup | TDBB_detaching | TDBB_wait_cancel_disable))
9237 return FB_SUCCESS;
9238
9239 if (attachment && attachment->att_purge_tid != Thread::getCurrentThreadId())
9240 {
9241 if (attachment->att_flags & ATT_shutdown)
9242 {
9243 if (database->dbb_ast_flags & DBB_shutdown)
9244 return isc_shutdown;
9245
9246 if (secondary)
9247 *secondary = attachment->getStable() ? attachment->getStable()->getShutError() : 0;
9248
9249 return isc_att_shutdown;
9250 }
9251
9252 // If a cancel has been raised, defer its acknowledgement
9253 // when executing in the context of an internal request or
9254 // the system transaction.
9255
9256 if ((attachment->att_flags & ATT_cancel_raise) &&
9257 !(attachment->att_flags & ATT_cancel_disable))
9258 {
9259 if ((!request ||
9260 !(request->getStatement()->flags &
9261 // temporary change to fix shutdown
9262 (/*Statement::FLAG_INTERNAL | */Statement::FLAG_SYS_TRIGGER))) &&
9263 (!transaction || !(transaction->tra_flags & TRA_system)))
9264 {
9265 return isc_cancelled;
9266 }
9267 }
9268 }
9269
9270 if (tdbb_reqTimer && tdbb_reqTimer->expired())
9271 {
9272 if (secondary)
9273 *secondary = tdbb_reqTimer->getErrCode();
9274
9275 return isc_cancelled;
9276 }
9277
9278 // Check the thread state for already posted system errors. If any still persists,
9279 // then someone tries to ignore our attempts to interrupt him. Let's insist.
9280
9281 if (tdbb_flags & TDBB_sys_error)
9282 return isc_cancelled;
9283
9284 return FB_SUCCESS;
9285}
9286

Callers 2

wait_for_requestMethod · 0.80
~EngineCheckoutMethod · 0.80

Calls 5

getShutErrorMethod · 0.80
getErrCodeMethod · 0.80
getStableMethod · 0.45
getStatementMethod · 0.45
expiredMethod · 0.45

Tested by

no test coverage detected